# Patch configuration file. See the README.txt file in the patch directory for
# information on how this configuration is used.
#
# Each dictionary entry in the "patches" map represents a single patch file.
# Supported key/value pairs are as follows:
#
# - 'name'       Required. The name of the patch file without the .patch
#                extension that will be read from the patches subdirectory.
# - 'path'       Optional. The repository root for the patch file. Defaults to
#                the Chromium "src" root. All patch file contents must be
#                relative to this repository root.
# - 'condition'  Optional. The patch file will only be applied if an environment
#                variable with this name exists.
#
# Each entry should also include a comment linking to the code review or bug
# report that the patch relates to.

patches = [
  {
    # Necessary for grit integration.
    'name': 'gritsettings',
  },
  {
    # Necessary for GN integration.
    #
    # Exclude the //chrome:packed_resources_locales target from the CEF build
    # due to conflicting outputs with the //cef:repack_locales_pack target.
    #
    # Write environment.* files with the correct SDK version on Windows.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=634788
    #
    # Windows: Add cc_wrapper support for sccache builds.
    # https://github.com/chromiumembedded/cef/issues/2432
    #
    # Windows: Add GN arg windows_sdk_version.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1420723
    'name': 'gn_config',
  },
  {
    # Patches that must be applied after `gclient sync --nohooks` and before
    # `gclient runhooks`.
    #
    # Support custom VS toolchain on Windows.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=623342
    'name': 'runhooks',
  },
  {
    # Support component builds (GN is_component_build=true).
    # https://github.com/chromiumembedded/cef/issues/1617
    'name': 'component_build',
  },
  {
    # Revert change on Windows that removes MessageLoop::os_modal_loop().
    # https://codereview.chromium.org/1992243003
    #
    # Revert change that removes MessageLoopForUI constructor.
    # https://chromium-review.googlesource.com/751322
    #
    # Add MessageLoop::ReleasePump to fix crashes during shutdown with multi-
    # threaded message loop mode.
    # https://github.com/chromiumembedded/cef/issues/2362
    'name': 'message_loop',
  },
  {
    # Add builtin trace event categories for CEF.
    # Required due to https://crrev.com/331266377d.
    'name': 'trace_event',
  },
  {
    # Enable popups in offscreen rendering on MacOS.
    'name': 'webkit_popups',
  },
  {
    # Give AlloyContentRendererClient access to protected
    # RuntimeEnabledFeatures methods.
    'name': 'webkit_runtime_enabled_features',
  },
  {
    # Allow specification of a parent window handle for Widget creation.
    # https://github.com/chromiumembedded/cef/issues/180
    #
    # Fix multiple handling of WM_MOUSEWHEEL messages on Windows.
    # https://github.com/chromiumembedded/cef/issues/1481
    #
    # Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
    # https://github.com/chromiumembedded/cef/issues/1565
    #
    # Fix focus/activation handling and keyboard input on Windows and Linux.
    # https://github.com/chromiumembedded/cef/issues/1677
    # https://github.com/chromiumembedded/cef/issues/1679
    # https://github.com/chromiumembedded/cef/issues/1700
    # https://github.com/chromiumembedded/cef/issues/3316
    #
    # Support creation of captionless windows with resizable borders.
    # https://github.com/chromiumembedded/cef/issues/1749
    #
    # Windows: When |params.remove_standard_frame| is true remove WS_CAPTION
    # and WS_SYSMENU styles. Otherwise Windows 10 enforces a minimum window
    # width of ~116 units that cannot be overridden.
    # Linux: Allow creation of activatable menu windows.
    # Linux: Support CefWindowDelegate::CanResize restriction by specifying
    # min/max Widget size values.
    # https://github.com/chromiumembedded/cef/issues/1947
    #
    # Support configuration of RWHVGuest device scale factor.
    # https://github.com/chromiumembedded/cef/issues/2078
    #
    # Windows: Fix focus assignment when clicking WebView with external parent.
    # https://github.com/chromiumembedded/cef/issues/3031
    #
    # Fix minimize & fullscreen behavior on initial Widget creation.
    #
    # Allow override of RWHVBase::GetNewScreenInfosForUpdate() which is now
    # required due to https://crrev.com/96938eb36e in order to use
    # RWHVBase::UpdateScreenInfo() with OSR.
    #
    # Windows: Fix incorrect DIPToScreenRect usage in DesktopWindowTreeHostWin
    # when |has_external_parent_| is true.
    # https://github.com/chromiumembedded/cef/issues/3359
    'name': 'views_widget',
  },
  {
    # Allow specification of a custom WebContentsView.
    # https://github.com/chromiumembedded/cef/issues/1257
    #
    # Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
    # https://github.com/chromiumembedded/cef/issues/1565
    #
    # Add WebContentsObserver::OnFrameFocused.
    #
    # Add WebContentsObserver::RenderWidgetCreated.
    # https://github.com/chromiumembedded/cef/issues/3308
    'name': 'web_contents_1257_1565',
  },
  {
    # Support custom RenderWidgetHostViewOSR for MimeHandlerViewGuest and
    # expose OnGuestAttached/Detached notifications.
    # https://github.com/chromiumembedded/cef/issues/1565
    # https://github.com/chromiumembedded/cef/issues/2727
    'name': 'mime_handler_view_guest_1565_2727',
  },
  {
    # Fix drag&drop of combined text and URL data on Linux/Aura.
    # https://codereview.chromium.org/208313009
    'name': 'ui_dragdrop_355390',
  },
  {
    # Split content::ContentMain into the separate steps required by CEF.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=654986#c17
    #
    # Remove DCHECK on Linux when initialized CEF from a non-main thread.
    # https://github.com/chromiumembedded/cef/issues/1639
    #
    # Fix DiscardableSharedMemoryManager crash on shutdown with multi-threaded
    # message loop.
    # https://github.com/chromiumembedded/cef/issues/2798
    'name': 'content_main_654986',
  },
  {
    # Expose the FontFamilyCache UserData key.
    # https://github.com/chromiumembedded/cef/issues/1501
    'name': 'font_family_cache_1501',
  },
  {
    # Modify views::View to extend SupportsUserData.
    # https://github.com/chromiumembedded/cef/issues/1749
    #
    # Don't add TestDesktopScreenOzone dependency on Linux.
    # Reverts ui_controls_factory_desktop_aurax11.cc (now
    # ui_controls_factory_desktop_aura_ozone.cc) changes from
    # https://codereview.chromium.org/2327623002
    #
    # Add InkDropHostView::ink_drop_mode method.
    # Reverts ink_drop_host_view.h changes from
    # https://codereview.chromium.org/2723843002
    #
    # Add LabelButton::SetFontList method.
    # Reverts label_button.[cc|h] changes from
    # https://codereview.chromium.org/2801583002
    #
    # Expose callbacks for mouse/keyboard events that trigger menu switching.
    # Add accelerator display support to Label.
    # https://github.com/chromiumembedded/cef/issues/2102
    #
    # Route |parent_widget| to MenuHost for OSR context menu Widget creation.
    # https://github.com/chromiumembedded/cef/issues/3330
    'name': 'views_1749_2102_3330',
  },
  {
    # Support CEF changes in chrome/browser.
    #
    # Fix duplicate symbols for enterprise_connectors::ContentAnalysisSdkManager
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1368633
    'name': 'chrome_browser',
  },
  {
    # Support CEF changes in chrome/renderer.
    'name': 'chrome_renderer',
  },
  {
    # Changes to support the Chrome runtime in CEF.
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_runtime',
  },
  {
    # Changes to support Chrome runtime integration with CEF Views.
    # See related documentation in
    # libcef/browser/chrome/views/chrome_browser_frame.h.
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_runtime_views',
  },
  {
    # Changes to support the Chrome runtime in CEF.
    # https://github.com/chromiumembedded/cef/issues/2969
    #
    # Fix fatal error: 'components/printing/common/print.mojom.h' file not found
    # From chrome/browser/ui/browser_commands.cc via
    # chrome/browser/printing/print_view_manager_common.h
    'name': 'chrome_browser_browser',
  },
  {
    # Don't initialize ExtensionSystemFactory when extensions are disabled.
    # https://github.com/chromiumembedded/cef/issues/2359
    #
    # Remove NOTREACHED() in GetContentSettingFromRulesImpl triggered by
    # NavigationTest.LoadCrossOriginLoadURL with the chrome runtime.
    'name': 'chrome_browser_content_settings',
  },
  {
    # chrome: Support custom handling of context menus.
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_browser_context_menus',
  },
  {
    # Support use of chrome native dialogs with CEF runtimes.
    # - Adds support for FileSelectHelper and SelectFileDialog interception.
    # - Adds additional type filters for dialogs created via FileSelectHelper.
    # - Adds support for chaining PrintingContextLinux callbacks.
    # https://github.com/chromiumembedded/cef/issues/3314
    'name': 'chrome_browser_dialogs_native',
  },
  {
    # Support use of chrome Widget dialogs with CEF runtimes.
    # - Add gfx::AcceleratedWidget dialog parent argument to
    #   DialogDelegate::CreateDialogWidget for CEF windowless rendering.
    # - Support nullptr gfx::NativeWindow/gfx::NativeView dialog parent for CEF
    #   windowless rendering.
    # https://github.com/chromiumembedded/cef/issues/3316
    'name': 'chrome_browser_dialogs_widget',
  },
  {
    # chrome: Support override of ChromeMimeHandlerViewGuestDelegate.
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_browser_extensions',
  },
  {
    # chrome: Expose static access to BrowserFrameMac methods.
    # https://github.com/chromiumembedded/cef/issues/3462
    'name': 'chrome_browser_frame_mac',
  },
  {
    # alloy: Disable ProxyErrorClient callbacks when extensions are disabled.
    # https://github.com/chromiumembedded/cef/issues/2830
    'name': 'chrome_browser_net_proxy',
  },
  {
    # Support override of CreatePermissionPrompt.
    # https://github.com/chromiumembedded/cef/issues/3352
    'name': 'chrome_browser_permission_prompt',
  },
  {
    # alloy: Don't initialize ExtensionSystemFactory when extensions are
    # disabled.
    # https://github.com/chromiumembedded/cef/issues/2852
    'name': 'chrome_browser_themes',
  },
  {
    # Make some methods of ProfileManager virtual.
    #
    # Don't create IdentityManager in RendererUpdater.
    # https://github.com/chromiumembedded/cef/issues/1917
    #
    # chrome: Support CEF incognito Profiles that allow Browser creation.
    # chrome: Allow CEF to delay OffTheRecordProfileImpl initialization.
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_browser_profiles',
  },
  {
    # chrome: Fix assertion when clicking the incognito profile button.
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_browser_profile_menu',
  },
  {
    # alloy: Don't require heap profiler for utility processes.
    # Avoids a DCHECK added in https://crrev.com/c21e9f71d1f2e
    'name': 'chrome_utility_client',
  },
  {
    # Support override of the User-Agent product component when NetworkService
    # is enabled.
    # https://github.com/chromiumembedded/cef/issues/2622
    'name': 'embedder_product_override',
  },
  {
    # Fix Jumbo/component build dependency issue.
    'name': 'chrome_browser_safe_browsing',
  },
  {
    # Allow CEF to share Chrome plugin loading code.
    #
    # Add BrowserPluginGuest::owner_web_contents() method.
    'name': 'chrome_plugins',
  },
  {
    # Don't create databases, blob_storage or VideoDecodeStats directories when
    # cache_path is empty.
    # https://github.com/chromiumembedded/cef/issues/2289
    'name': 'storage_incognito_2289',
  },
  {
    # Support WebUI by removing dependency on non-NULL IOThread* object.
    # https://github.com/chromiumembedded/cef/issues/2037
    'name': 'webui_2037',
  },
  {
    # Implement breakpad/crashpad customization required by CEF.
    # https://github.com/chromiumembedded/cef/issues/1995
    'name': 'crashpad_1995',
  },
  {
    # Support customization of crash report pruning limits.
    # https://bugs.chromium.org/p/crashpad/issues/detail?id=142
    #
    # Implement better rate-limiting/retry logic.
    # https://bugs.chromium.org/p/crashpad/issues/detail?id=23
    'name': 'crashpad_tp_1995',
  },
  {
    # Fix white flash during browser creation.
    # https://github.com/chromiumembedded/cef/issues/1984
    #
    # Windows: Fix crash during window creation.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=761389
    'name': 'rwh_background_color_1984',
  },
  {
    # Expose RFH via NavigationHandle for retrieval in DidFinishNavigation on
    # network error.
    # https://groups.google.com/a/chromium.org/d/msg/chromium-dev/6iAQPx_hwh8/gaTR5f1GAQAJ
    #
    # Add ContentRendererClient::RenderThreadConnected to fix sync IPC issue.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=728195
    #
    # Add ContentRendererClient::DevToolsAgent[Attached|Detached] methods.
    #
    # Always return the Chrome product value for DevTools.
    # https://github.com/chromiumembedded/cef/issues/2300
    #
    # Add new ContentBrowserClient::HandleExternalProtocol variant for use with
    # the NetworkService.
    # https://github.com/chromiumembedded/cef/issues/2622
    #
    # Change ContentBrowserClient::ConfigureNetworkContextParams return type to
    # bool to support cancellation of NetworkContext creation during shutdown.
    # https://github.com/chromiumembedded/cef/issues/2985
    'name': 'content_2015',
  },
  {
    # Add ContentRendererClient::DevToolsAgent[Attached|Detached] methods.
    'name': 'webkit_plugin_info_2015',
  },
  {
    # Linux: Attach routing IDs to PrintingContext.
    # https://github.com/chromiumembedded/cef/issues/2196
    'name': 'printing_context_2196',
  },
  {
    # Windows: Remove llvmlibthin as the combine_libs.py can't handle those.
    # https://github.com/chromiumembedded/cef/issues/2470
    'name': 'build',
  },
  {
    # Changes necessary to support chrome extensions. Add a new
    # ExtensionHost constructor that allows CEF to create the WebContents.
    # https://github.com/chromiumembedded/cef/issues/1947
    #
    # Don't initialize PrerenderContents object in StreamsPrivateAPI.
    #
    # Return nullptr from ExtensionsClient::Get and ExtensionRegistry::Get
    # when extensions are disabled.
    'name': 'extensions_1947',
  },
  {
    # macOS: Make the NativeEventProcessor protocol dependency optional.
    # https://github.com/chromiumembedded/cef/issues/2539
    'name': 'mac_event_observer_2539',
  },
  {
    # macOS: Fix crash when scrolling in OSR mode.
    # https://github.com/chromiumembedded/cef/issues/2540
    'name': 'mac_fling_scheduler_2540',
  },
  {
    # Allow ResourceBundle creation/destruction on the main thread and usage on
    # the UI thread.
    # https://github.com/chromiumembedded/cef/issues/2398
    'name': 'resource_bundle_2512',
  },
  {
    # macOS: Fix crash when showing a select popup with CefDoMessageLoopWork.
    # https://github.com/chromiumembedded/cef/issues/2495
    'name': 'message_pump_mac_2495',
  },
  {
    # Linux: Load binaries from DIR_ASSETS.
    # https://github.com/chromiumembedded/cef/issues/1936
    'name': 'linux_assets_path_1936',
  },
  {
    # Linux: Fix ld.lld: error: relocation R_X86_64_TPOFF32 against
    # blink::g_thread_specific_ cannot be used with -shared
    # https://groups.google.com/a/chromium.org/g/blink-dev/c/wx0gZFCY3p4/m/iLBHRi0ZAQAJ
    'name': 'linux_blink_thread_local',
  },
  {
    # Linux: Avoid usage of chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT.
    # https://github.com/chromiumembedded/cef/issues/3149
    'name': 'linux_chrome_widevine_3149',
  },
  {
    # Enhancements to NetworkService:
    # - Add support for calling CookieMonster::SetCookieableSchemes.
    # - Fix cache directory structure ("C:\temp\cache\cache\Cache" should be
    #   "C:\temp\cache\Cache").
    # https://github.com/chromiumembedded/cef/issues/2622
    #
    # alloy: Avoid initialization of privacy sandbox and identity manager.
    # https://github.com/chromiumembedded/cef/issues/3434
    'name': 'services_network_2622',
  },
  {
    # Enhancements to NetworkService:
    # - Remove the non-nullptr WebContents requirement from
    #   NetworkServiceClient::OnAuthRequired.
    # https://github.com/chromiumembedded/cef/issues/2718
    #
    # Change ContentBrowserClient::ConfigureNetworkContextParams return type to
    # bool to support cancellation of NetworkContext creation during shutdown.
    # https://github.com/chromiumembedded/cef/issues/2985
    #
    # Compute correct default quota when cache_path is unspecified.
    'name': 'services_network_2718',
  },
  {
    # Restore the net::LOAD_DO_NOT_SEND_COOKIES flag to support disabling of
    # cookie load/save on a per-request basis.
    # Partially reverts the changes from
    # https://chromium.googlesource.com/chromium/src/+/25eaa43022
    'name': 'net_cookie_flags',
  },
  {
    # Restore WebView::SetResizeBackgroundColor() that was removed.
    # http://crrev.com/3955c9f9eb
    'name': 'set_resize_background_color',
  },
  {
    # Avoid a shutdown crash with multi-threaded message loop caused by
    # |g_browser_task_executor->browser_ui_thread_scheduler_| being null when
    # BrowserTaskExecutor::Shutdown is called via CefContext::FinalizeShutdown.
    # This crash was introduced by https://crrev.com/5f6212babf.
    'name': 'browser_scheduler',
  },
  {
    # Restore access to WebUIControllerFactory::UnregisterFactoryForTesting
    # which was removed in https://crrev.com/5f183d6636. We can't use
    # ScopedWebUIControllerFactoryRegistration because it pulls in GTest
    # dependencies.
    #
    # Add accessor for WebUIConfigMap::webui_controller_factory_.
    'name': 'browser_web_ui_controller_factory',
  },
  {
    # Avoid a shutdown crash caused by PrefWatcher holding a reference to
    # |g_browser_process->local_state()|, and the local_state being deleted
    # before the PrefWatcher object (which is associated with a Profile).
    # PrefWatcher::Shutdown will now be called from ChromeBrowserProcessStub::
    # Shutdown for all Profiles before local_state deletion.
    # This crash was introduced by https://crrev.com/7d032b378c.
    'name': 'chrome_pref_watcher',
  },
  {
    # Add support for OSR rendering with Viz.
    # https://github.com/chromiumembedded/cef/issues/2575
    'name': 'viz_osr_2575',
  },
  {
    # Changes for print preview support:
    # - Don't attach unnecessary Chrome-related handlers to constrained window.
    # - Create file dialogs using the CEF code path.
    # - Remove unsupported print preview UI options.
    # - macOS: Fix error: no member named 'kCloudPrinterHandler' in namespace
    #   'printing::features',
    # https://github.com/chromiumembedded/cef/issues/123
    'name': 'print_preview_123',
  },
  {
    # Store command-line switch names as lower-case ASCII on all platforms.
    # https://github.com/chromiumembedded/cef/issues/1872
    'name': 'base_command_line_1872',
  },
  {
    # Remove cef_sandbox dependency on boringssl functions.
    # https://github.com/chromiumembedded/cef/issues/2743
    #
    # Enable the VS 2015 Update 2 fix when building with the MSVC standard
    # library.
    #
    # Avoid usage of std::atomic_flag::test() added in C++20.
    # https://github.com/llvm/llvm-project/issues/57364
    #
    # Avoid usage of PartitionAlloc assertions (PA_BASE_CHECK) in raw_ptr.h.
    'name': 'base_sandbox_2743',
  },
  {
    # Add RenderWidgetHostImpl::SetCompositorForFlingScheduler to fix fling
    # scrolling in OSR mode.
    # https://github.com/chromiumembedded/cef/issues/2745
    'name': 'osr_fling_2745',
  },
  {
    # Windows: Build targets as C++17 to avoid export of std::is_integral
    # templates in cef_sandbox that should be inlined.
    # https://github.com/chromiumembedded/cef/issues/2819
    'name': 'win_cpp17_msvc_sandbox_2819',
  },
  {
    # libxml access is now limited to targets audited by the Security Team.
    # https://chromium-review.googlesource.com/c/chromium/src/+/1884750
    'name': 'libxml_visibility',
  },
  {
    # Fix unbound AssociatedRemote error in SetBackgroundOpaque.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1070713
    'name': 'renderer_host_1070713',
  },
  {
    # Allow the loading of non-standard non-local WebSafe custom schemes in
    # iframes.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1081397#c9
    #
    # Fix crash in NavigationRequest::GetOriginForURLLoaderFactory() when
    # navigating to an unregistered (e.g. non-standard) scheme.
    # https://github.com/chromiumembedded/cef/issues/3105
    'name': 'browser_security_policy_1081397',
  },
  {
    # Fix build errors with enable_background_mode=false.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1100085
    #
    # Changes to support the Chrome runtime in CEF (app_controller_mac.mm).
    # https://github.com/chromiumembedded/cef/issues/2969
    'name': 'chrome_browser_background_mode_1100085',
  },
  {
    # Linux: Fix ATK assertion error when generating ARM build config.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1123214
    'name': 'linux_atk_1123214',
  },
  {
    # Windows: Fix crash when |sandbox_info| parameter is nullptr.
    # https://github.com/chromiumembedded/cef/issues/3210
    'name': 'win_sandbox_3210',
  },
  {
    # Windows: Always use the root window as the owner for shell dialogs.
    # https://github.com/chromiumembedded/cef/issues/3294
    'name': 'win_shell_dialogs_3294',
  },
  {
    # Linux: Fix duplicate symbol error due to bluez/metrics_recorder.cc.
    # https://bugs.chromium.org/p/chromium/issues/detail?id=1319006
    'name': 'linux_bluetooth_1319006',
  },
  {
    # Linux: Support chaining of PrintingContextLinux callbacks.
    # https://github.com/chromiumembedded/cef/issues/3314
    # Also reverts the changes from https://crrev.com/db245883e1
    'name': 'linux_printing_context',
  },
  {
    # Fix deadlock in EmbeddedTestServer::ShutdownAndWaitUntilComplete.
    # https://chromium-review.googlesource.com/c/chromium/src/+/3798752
    'name': 'net_test_server_3798752'
  },
  {
    # Linux: Fix "error: use of result of assignment to object of volatile-
    # qualified type 'volatile gsize' (aka 'volatile unsigned long') is
    # deprecated [-Werror,-Wdeprecated-volatile]" when building with
    # use_sysroot=false on Ubuntu 18.04.
    # https://chromium-review.googlesource.com/c/chromium/src/+/3960017
    'name': 'linux_glib_deprecated_volatile'
  },
  {
    # Restore low-level attribute access from WebElement which was removed in
    # https://chromium-review.googlesource.com/c/chromium/src/+/4200240
    'name': 'blink_web_element_4200240'
  },
  {
    # Fix ThreadChecker crash on startup with Chrome runtime + multi-threaded
    # message loop.
    'name': 'metrics_system_profile'
  },
  {
    # macOS: Remove run-time dependency on libtest_trace_processor.dylib
    # Reverts the changes from https://crrev.com/8b18bd125d
    'name': 'base_test_4396276'
  }
]