2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-04-12 01:46:58 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/electron_browser_client.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2015-08-04 09:13:05 +00:00
|
|
|
#include <shlobj.h>
|
|
|
|
#endif
|
|
|
|
|
2018-09-13 00:25:56 +00:00
|
|
|
#include <memory>
|
2024-07-29 13:37:35 +00:00
|
|
|
#include <string_view>
|
2018-09-13 00:25:56 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2020-05-07 20:31:26 +00:00
|
|
|
#include "base/base_switches.h"
|
2014-10-24 10:44:15 +00:00
|
|
|
#include "base/command_line.h"
|
2021-02-19 23:08:49 +00:00
|
|
|
#include "base/debug/crash_logging.h"
|
2018-03-16 02:05:51 +00:00
|
|
|
#include "base/environment.h"
|
2024-07-29 17:42:57 +00:00
|
|
|
#include "base/files/file_path.h"
|
2015-06-10 11:34:30 +00:00
|
|
|
#include "base/files/file_util.h"
|
2018-09-13 00:25:56 +00:00
|
|
|
#include "base/no_destructor.h"
|
2018-10-23 08:45:41 +00:00
|
|
|
#include "base/path_service.h"
|
2024-07-25 09:25:45 +00:00
|
|
|
#include "base/process/process_metrics.h"
|
2022-05-17 16:48:40 +00:00
|
|
|
#include "base/strings/escape.h"
|
2016-08-24 00:16:54 +00:00
|
|
|
#include "base/strings/string_util.h"
|
2018-11-07 13:23:09 +00:00
|
|
|
#include "chrome/browser/browser_process.h"
|
2020-05-07 20:31:26 +00:00
|
|
|
#include "chrome/common/chrome_paths.h"
|
2021-05-14 12:06:55 +00:00
|
|
|
#include "chrome/common/chrome_switches.h"
|
2019-01-21 18:32:34 +00:00
|
|
|
#include "chrome/common/chrome_version.h"
|
2022-06-13 16:35:42 +00:00
|
|
|
#include "components/embedder_support/user_agent_utils.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "components/net_log/chrome_net_log.h"
|
2019-11-05 23:41:20 +00:00
|
|
|
#include "components/network_hints/common/network_hints.mojom.h"
|
2021-10-28 14:23:05 +00:00
|
|
|
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" // nogncheck
|
2021-03-16 14:45:47 +00:00
|
|
|
#include "content/browser/site_instance_impl.h" // nogncheck
|
2020-01-13 22:55:58 +00:00
|
|
|
#include "content/public/browser/browser_main_runner.h"
|
2019-01-12 01:00:43 +00:00
|
|
|
#include "content/public/browser/browser_task_traits.h"
|
2015-06-03 20:57:06 +00:00
|
|
|
#include "content/public/browser/client_certificate_delegate.h"
|
2019-11-11 17:47:01 +00:00
|
|
|
#include "content/public/browser/login_delegate.h"
|
2019-10-28 22:12:35 +00:00
|
|
|
#include "content/public/browser/overlay_window.h"
|
2018-03-06 06:24:54 +00:00
|
|
|
#include "content/public/browser/render_frame_host.h"
|
2014-01-30 13:57:01 +00:00
|
|
|
#include "content/public/browser/render_process_host.h"
|
2014-03-06 03:07:04 +00:00
|
|
|
#include "content/public/browser/render_view_host.h"
|
2021-04-27 21:27:34 +00:00
|
|
|
#include "content/public/browser/service_worker_version_base_info.h"
|
2014-01-31 02:30:16 +00:00
|
|
|
#include "content/public/browser/site_instance.h"
|
2020-07-14 01:13:34 +00:00
|
|
|
#include "content/public/browser/tts_controller.h"
|
|
|
|
#include "content/public/browser/tts_platform.h"
|
2022-03-30 18:55:38 +00:00
|
|
|
#include "content/public/browser/url_loader_request_interceptor.h"
|
2022-08-26 10:31:33 +00:00
|
|
|
#include "content/public/browser/weak_document_ptr.h"
|
2020-05-07 20:31:26 +00:00
|
|
|
#include "content/public/common/content_descriptors.h"
|
2018-01-22 22:49:30 +00:00
|
|
|
#include "content/public/common/content_paths.h"
|
2017-07-07 22:14:25 +00:00
|
|
|
#include "content/public/common/content_switches.h"
|
2016-09-29 17:20:53 +00:00
|
|
|
#include "content/public/common/url_constants.h"
|
2022-02-10 02:58:52 +00:00
|
|
|
#include "crypto/crypto_buildflags.h"
|
2018-10-01 20:00:53 +00:00
|
|
|
#include "electron/buildflags/buildflags.h"
|
2023-11-09 18:23:52 +00:00
|
|
|
#include "electron/fuses.h"
|
2020-12-14 18:57:36 +00:00
|
|
|
#include "electron/shell/common/api/api.mojom.h"
|
2023-10-04 08:40:01 +00:00
|
|
|
#include "extensions/browser/extension_navigation_ui_data.h"
|
2024-06-07 21:18:35 +00:00
|
|
|
#include "extensions/common/extension_id.h"
|
2020-05-26 20:06:26 +00:00
|
|
|
#include "mojo/public/cpp/bindings/binder_map.h"
|
2024-08-12 08:28:33 +00:00
|
|
|
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
2015-06-03 20:57:06 +00:00
|
|
|
#include "net/ssl/ssl_cert_request_info.h"
|
2023-07-20 07:36:59 +00:00
|
|
|
#include "net/ssl/ssl_private_key.h"
|
2018-10-13 01:57:04 +00:00
|
|
|
#include "printing/buildflags/buildflags.h"
|
2024-03-15 18:03:42 +00:00
|
|
|
#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
|
2018-10-02 22:01:24 +00:00
|
|
|
#include "services/device/public/cpp/geolocation/location_provider.h"
|
2019-03-26 01:10:48 +00:00
|
|
|
#include "services/network/public/cpp/features.h"
|
2022-03-09 15:15:50 +00:00
|
|
|
#include "services/network/public/cpp/is_potentially_trustworthy.h"
|
|
|
|
#include "services/network/public/cpp/network_switches.h"
|
2018-04-11 08:42:14 +00:00
|
|
|
#include "services/network/public/cpp/resource_request_body.h"
|
2021-03-04 17:27:05 +00:00
|
|
|
#include "services/network/public/cpp/self_deleting_url_loader_factory.h"
|
2024-01-31 23:04:13 +00:00
|
|
|
#include "services/network/public/cpp/url_loader_factory_builder.h"
|
2020-07-30 00:45:02 +00:00
|
|
|
#include "shell/app/electron_crash_reporter_client.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/api/electron_api_app.h"
|
2020-05-07 20:31:26 +00:00
|
|
|
#include "shell/browser/api/electron_api_crash_reporter.h"
|
2019-10-24 00:51:06 +00:00
|
|
|
#include "shell/browser/api/electron_api_protocol.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/api/electron_api_web_contents.h"
|
2019-10-24 00:51:06 +00:00
|
|
|
#include "shell/browser/api/electron_api_web_request.h"
|
2021-01-21 05:45:06 +00:00
|
|
|
#include "shell/browser/badging/badge_manager.h"
|
2024-07-29 17:42:57 +00:00
|
|
|
#include "shell/browser/bluetooth/electron_bluetooth_delegate.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/child_web_contents_tracker.h"
|
2022-03-19 02:50:05 +00:00
|
|
|
#include "shell/browser/electron_api_ipc_handler_impl.h"
|
2019-08-19 20:13:24 +00:00
|
|
|
#include "shell/browser/electron_autofill_driver_factory.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/electron_browser_context.h"
|
|
|
|
#include "shell/browser/electron_browser_main_parts.h"
|
|
|
|
#include "shell/browser/electron_navigation_throttle.h"
|
2024-08-12 08:28:33 +00:00
|
|
|
#include "shell/browser/electron_plugin_info_host_impl.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/electron_speech_recognition_manager_delegate.h"
|
2022-03-19 02:50:05 +00:00
|
|
|
#include "shell/browser/electron_web_contents_utility_handler_impl.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/font_defaults.h"
|
2024-07-29 17:42:57 +00:00
|
|
|
#include "shell/browser/hid/electron_hid_delegate.h"
|
2020-06-22 16:35:24 +00:00
|
|
|
#include "shell/browser/javascript_environment.h"
|
2024-07-25 09:25:45 +00:00
|
|
|
#include "shell/browser/login_handler.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/media/media_capture_devices_dispatcher.h"
|
|
|
|
#include "shell/browser/native_window.h"
|
|
|
|
#include "shell/browser/net/network_context_service.h"
|
|
|
|
#include "shell/browser/net/network_context_service_factory.h"
|
|
|
|
#include "shell/browser/net/proxying_url_loader_factory.h"
|
2020-02-11 05:56:09 +00:00
|
|
|
#include "shell/browser/net/proxying_websocket.h"
|
2019-08-07 15:04:09 +00:00
|
|
|
#include "shell/browser/net/system_network_context_manager.h"
|
2019-11-05 23:41:20 +00:00
|
|
|
#include "shell/browser/network_hints_handler_impl.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/notifications/notification_presenter.h"
|
|
|
|
#include "shell/browser/notifications/platform_notification_service.h"
|
2020-03-26 17:34:32 +00:00
|
|
|
#include "shell/browser/protocol_registry.h"
|
2020-09-28 16:22:03 +00:00
|
|
|
#include "shell/browser/serial/electron_serial_delegate.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/session_preferences.h"
|
|
|
|
#include "shell/browser/ui/devtools_manager_delegate.h"
|
2024-07-29 17:42:57 +00:00
|
|
|
#include "shell/browser/usb/electron_usb_delegate.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/web_contents_permission_helper.h"
|
|
|
|
#include "shell/browser/web_contents_preferences.h"
|
2022-09-20 22:47:42 +00:00
|
|
|
#include "shell/browser/webauthn/electron_authenticator_request_delegate.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/window_list.h"
|
2019-08-19 20:13:24 +00:00
|
|
|
#include "shell/common/api/api.mojom.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/application_info.h"
|
2020-05-07 20:31:26 +00:00
|
|
|
#include "shell/common/electron_paths.h"
|
2021-06-17 21:17:25 +00:00
|
|
|
#include "shell/common/logging.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/options_switches.h"
|
|
|
|
#include "shell/common/platform_util.h"
|
2024-08-12 08:28:33 +00:00
|
|
|
#include "shell/common/plugin.mojom.h"
|
2022-11-17 19:59:23 +00:00
|
|
|
#include "shell/common/thread_restrictions.h"
|
2023-10-04 08:40:01 +00:00
|
|
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
2020-04-29 06:16:10 +00:00
|
|
|
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
|
chore: bump chromium to 118.0.5975.0 (main) (#39531)
* chore: bump chromium in DEPS to 118.0.5951.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894
No logic changes, but patch needed to be manually re-applied due to upstream code shear
* chore: update port_autofill_colors_to_the_color_pipeline.patch
No manual changes; patch applied with fuzz
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5953.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5955.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5957.0
* chore: update patches
* chore: include path of native_web_keyboard_event.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
* chore: remove reference to eextensions/browser/notification-types.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627
* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?
* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198
* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277
Exiting upstream code used by chromium_src now depends on this new upstream class
* chore: bump chromium in DEPS to 118.0.5959.0
* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
manually adjust patch to minor upstream chagnes
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5961.0
* chore: bump chromium in DEPS to 118.0.5963.0
* chore: update patches
* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994
* Many files moved from `mac` -> `apple`
This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too
* fixup minor patch update error
A function param got dropped from this patch somewhere earlier
* chore: bump chromium in DEPS to 118.0.5965.2
* chore: update patches
* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213
* Fix removed include to BrowserContext
In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.
* chore: bump chromium in DEPS to 118.0.5967.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5969.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5971.0
* chore: bump chromium in DEPS to 118.0.5973.0
* chore: update patches
* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121
* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164
* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488
Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.
* chore: bump chromium in DEPS to 118.0.5975.0
* chore: update patches
* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build
* Reland "[windows] Remove RegKey::DeleteEmptyKey"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255
* Ensure StrCat means StrCat
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180
* fixup! Remove RegKey::DeleteEmptyKey
* Consistently reject large p and large q in DH
Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-01 06:54:59 +00:00
|
|
|
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
|
2021-04-23 19:57:40 +00:00
|
|
|
#include "third_party/blink/public/common/tokens/tokens.h"
|
2020-09-21 08:00:36 +00:00
|
|
|
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
|
2020-09-08 15:13:56 +00:00
|
|
|
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
|
2018-10-04 18:08:56 +00:00
|
|
|
#include "ui/base/resource/resource_bundle.h"
|
2019-07-15 08:22:25 +00:00
|
|
|
#include "ui/native_theme/native_theme.h"
|
2015-09-04 17:33:13 +00:00
|
|
|
#include "v8/include/v8.h"
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(USE_NSS_CERTS)
|
2018-04-12 08:48:50 +00:00
|
|
|
#include "net/ssl/client_cert_store_nss.h"
|
2024-07-17 13:48:03 +00:00
|
|
|
#include "shell/browser/electron_crypto_module_delegate_nss.h"
|
2022-02-10 02:58:52 +00:00
|
|
|
#elif BUILDFLAG(IS_WIN)
|
2018-04-12 08:48:50 +00:00
|
|
|
#include "net/ssl/client_cert_store_win.h"
|
2022-02-10 02:58:52 +00:00
|
|
|
#elif BUILDFLAG(IS_MAC)
|
2018-04-12 08:48:50 +00:00
|
|
|
#include "net/ssl/client_cert_store_mac.h"
|
|
|
|
#elif defined(USE_OPENSSL)
|
|
|
|
#include "net/ssl/client_cert_store.h"
|
|
|
|
#endif
|
|
|
|
|
2019-10-31 20:11:51 +00:00
|
|
|
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
|
|
|
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" // nogncheck
|
2024-01-03 08:52:49 +00:00
|
|
|
#include "chrome/browser/spellchecker/spell_check_initialization_host_impl.h" // nogncheck
|
2019-10-31 20:11:51 +00:00
|
|
|
#include "components/spellcheck/common/spellcheck.mojom.h" // nogncheck
|
|
|
|
#endif
|
|
|
|
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/fake_location_provider.h"
|
2018-10-01 20:00:53 +00:00
|
|
|
#endif // BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
2018-08-23 15:51:46 +00:00
|
|
|
|
2020-01-13 22:55:58 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2023-11-03 19:37:55 +00:00
|
|
|
#include "base/functional/bind.h"
|
2020-02-13 00:39:12 +00:00
|
|
|
#include "chrome/common/webui_url_constants.h"
|
2023-11-03 19:37:55 +00:00
|
|
|
#include "components/guest_view/common/guest_view.mojom.h"
|
2020-02-13 00:39:12 +00:00
|
|
|
#include "content/public/browser/child_process_security_policy.h"
|
|
|
|
#include "content/public/browser/file_url_loader.h"
|
|
|
|
#include "content/public/browser/web_ui_url_loader_factory.h"
|
|
|
|
#include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
|
2020-12-18 23:11:43 +00:00
|
|
|
#include "extensions/browser/api/web_request/web_request_api.h"
|
2020-08-03 23:56:18 +00:00
|
|
|
#include "extensions/browser/browser_context_keyed_api_factory.h"
|
2021-08-30 18:22:46 +00:00
|
|
|
#include "extensions/browser/event_router.h"
|
2020-02-13 00:39:12 +00:00
|
|
|
#include "extensions/browser/extension_host.h"
|
2020-01-13 22:55:58 +00:00
|
|
|
#include "extensions/browser/extension_navigation_throttle.h"
|
2021-05-14 12:06:55 +00:00
|
|
|
#include "extensions/browser/extension_prefs.h"
|
2020-08-03 23:56:18 +00:00
|
|
|
#include "extensions/browser/extension_protocols.h"
|
2020-01-13 22:55:58 +00:00
|
|
|
#include "extensions/browser/extension_registry.h"
|
2020-04-29 06:16:10 +00:00
|
|
|
#include "extensions/browser/extensions_browser_client.h"
|
2022-02-25 18:17:35 +00:00
|
|
|
#include "extensions/browser/guest_view/extensions_guest_view.h"
|
2020-02-13 00:39:12 +00:00
|
|
|
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
|
|
|
#include "extensions/browser/process_manager.h"
|
2020-01-13 22:55:58 +00:00
|
|
|
#include "extensions/browser/process_map.h"
|
2023-11-03 19:37:55 +00:00
|
|
|
#include "extensions/browser/renderer_startup_helper.h"
|
2023-08-01 06:04:38 +00:00
|
|
|
#include "extensions/browser/service_worker/service_worker_host.h"
|
2020-08-03 23:56:18 +00:00
|
|
|
#include "extensions/browser/url_loader_factory_manager.h"
|
2020-02-13 00:39:12 +00:00
|
|
|
#include "extensions/common/api/mime_handler.mojom.h"
|
2020-08-03 23:56:18 +00:00
|
|
|
#include "extensions/common/constants.h"
|
2020-01-13 22:55:58 +00:00
|
|
|
#include "extensions/common/extension.h"
|
2023-11-03 19:37:55 +00:00
|
|
|
#include "extensions/common/mojom/event_router.mojom.h"
|
|
|
|
#include "extensions/common/mojom/guest_view.mojom.h"
|
|
|
|
#include "extensions/common/mojom/renderer_host.mojom.h"
|
2020-08-03 23:56:18 +00:00
|
|
|
#include "extensions/common/switches.h"
|
2020-02-03 22:01:10 +00:00
|
|
|
#include "shell/browser/extensions/electron_extension_system.h"
|
2020-02-13 00:39:12 +00:00
|
|
|
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PLUGINS)
|
|
|
|
#include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h" // nogncheck
|
|
|
|
#include "shell/browser/plugins/plugin_utils.h"
|
2020-01-13 22:55:58 +00:00
|
|
|
#endif
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2023-02-03 11:43:42 +00:00
|
|
|
#include "content/browser/mac_helpers.h"
|
|
|
|
#include "content/public/browser/child_process_host.h"
|
2019-07-03 01:22:09 +00:00
|
|
|
#endif
|
|
|
|
|
2022-10-17 14:22:24 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2020-06-16 21:19:57 +00:00
|
|
|
#include "components/crash/core/app/crash_switches.h" // nogncheck
|
|
|
|
#include "components/crash/core/app/crashpad.h" // nogncheck
|
2020-05-07 20:31:26 +00:00
|
|
|
#endif
|
|
|
|
|
2023-06-08 06:56:31 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2022-02-25 18:17:35 +00:00
|
|
|
#include "chrome/browser/ui/views/overlay/video_overlay_window_views.h"
|
2020-09-21 08:00:36 +00:00
|
|
|
#include "shell/browser/browser.h"
|
|
|
|
#include "ui/aura/window.h"
|
|
|
|
#include "ui/aura/window_tree_host.h"
|
|
|
|
#include "ui/base/win/shell.h"
|
|
|
|
#include "ui/views/widget/widget.h"
|
|
|
|
#endif
|
|
|
|
|
2021-08-24 00:52:17 +00:00
|
|
|
#if BUILDFLAG(ENABLE_PRINTING)
|
|
|
|
#include "shell/browser/printing/print_view_manager_electron.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
2022-03-30 18:55:38 +00:00
|
|
|
#include "chrome/browser/pdf/chrome_pdf_stream_delegate.h"
|
|
|
|
#include "chrome/browser/plugins/pdf_iframe_navigation_throttle.h" // nogncheck
|
chore: bump chromium to 118.0.5975.0 (main) (#39531)
* chore: bump chromium in DEPS to 118.0.5951.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894
No logic changes, but patch needed to be manually re-applied due to upstream code shear
* chore: update port_autofill_colors_to_the_color_pipeline.patch
No manual changes; patch applied with fuzz
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5953.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5955.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5957.0
* chore: update patches
* chore: include path of native_web_keyboard_event.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
* chore: remove reference to eextensions/browser/notification-types.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627
* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?
* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198
* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277
Exiting upstream code used by chromium_src now depends on this new upstream class
* chore: bump chromium in DEPS to 118.0.5959.0
* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
manually adjust patch to minor upstream chagnes
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5961.0
* chore: bump chromium in DEPS to 118.0.5963.0
* chore: update patches
* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994
* Many files moved from `mac` -> `apple`
This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too
* fixup minor patch update error
A function param got dropped from this patch somewhere earlier
* chore: bump chromium in DEPS to 118.0.5965.2
* chore: update patches
* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213
* Fix removed include to BrowserContext
In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.
* chore: bump chromium in DEPS to 118.0.5967.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5969.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5971.0
* chore: bump chromium in DEPS to 118.0.5973.0
* chore: update patches
* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121
* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164
* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488
Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.
* chore: bump chromium in DEPS to 118.0.5975.0
* chore: update patches
* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build
* Reland "[windows] Remove RegKey::DeleteEmptyKey"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255
* Ensure StrCat means StrCat
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180
* fixup! Remove RegKey::DeleteEmptyKey
* Consistently reject large p and large q in DH
Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-01 06:54:59 +00:00
|
|
|
#include "components/pdf/browser/pdf_document_helper.h" // nogncheck
|
2022-03-30 18:55:38 +00:00
|
|
|
#include "components/pdf/browser/pdf_navigation_throttle.h"
|
|
|
|
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
2024-05-01 00:32:11 +00:00
|
|
|
#include "components/pdf/common/constants.h" // nogncheck
|
chore: bump chromium to 118.0.5975.0 (main) (#39531)
* chore: bump chromium in DEPS to 118.0.5951.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894
No logic changes, but patch needed to be manually re-applied due to upstream code shear
* chore: update port_autofill_colors_to_the_color_pipeline.patch
No manual changes; patch applied with fuzz
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5953.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5955.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5957.0
* chore: update patches
* chore: include path of native_web_keyboard_event.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
* chore: remove reference to eextensions/browser/notification-types.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627
* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?
* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198
* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277
Exiting upstream code used by chromium_src now depends on this new upstream class
* chore: bump chromium in DEPS to 118.0.5959.0
* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
manually adjust patch to minor upstream chagnes
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5961.0
* chore: bump chromium in DEPS to 118.0.5963.0
* chore: update patches
* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994
* Many files moved from `mac` -> `apple`
This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too
* fixup minor patch update error
A function param got dropped from this patch somewhere earlier
* chore: bump chromium in DEPS to 118.0.5965.2
* chore: update patches
* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213
* Fix removed include to BrowserContext
In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.
* chore: bump chromium in DEPS to 118.0.5967.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5969.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5971.0
* chore: bump chromium in DEPS to 118.0.5973.0
* chore: update patches
* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121
* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164
* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488
Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.
* chore: bump chromium in DEPS to 118.0.5975.0
* chore: update patches
* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build
* Reland "[windows] Remove RegKey::DeleteEmptyKey"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255
* Ensure StrCat means StrCat
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180
* fixup! Remove RegKey::DeleteEmptyKey
* Consistently reject large p and large q in DH
Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-01 06:54:59 +00:00
|
|
|
#include "shell/browser/electron_pdf_document_helper_client.h"
|
2021-08-24 00:52:17 +00:00
|
|
|
#endif
|
|
|
|
|
2018-03-14 07:55:59 +00:00
|
|
|
using content::BrowserThread;
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
namespace electron {
|
|
|
|
|
2014-01-31 02:30:16 +00:00
|
|
|
namespace {
|
|
|
|
|
2018-10-23 08:45:41 +00:00
|
|
|
ElectronBrowserClient* g_browser_client = nullptr;
|
|
|
|
|
2024-01-12 13:50:29 +00:00
|
|
|
base::NoDestructor<std::string> g_io_thread_application_locale;
|
2018-10-23 08:45:41 +00:00
|
|
|
|
|
|
|
base::NoDestructor<std::string> g_application_locale;
|
|
|
|
|
|
|
|
void SetApplicationLocaleOnIOThread(const std::string& locale) {
|
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
2024-01-12 13:50:29 +00:00
|
|
|
*g_io_thread_application_locale = locale;
|
2018-10-23 08:45:41 +00:00
|
|
|
}
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
void BindNetworkHintsHandler(
|
|
|
|
content::RenderFrameHost* frame_host,
|
|
|
|
mojo::PendingReceiver<network_hints::mojom::NetworkHintsHandler> receiver) {
|
|
|
|
NetworkHintsHandlerImpl::Create(frame_host, std::move(receiver));
|
|
|
|
}
|
|
|
|
|
2020-02-06 21:42:34 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
// Used by the GetPrivilegeRequiredByUrl() and GetProcessPrivilege() functions
|
|
|
|
// below. Extension, and isolated apps require different privileges to be
|
|
|
|
// granted to their RenderProcessHosts. This classification allows us to make
|
|
|
|
// sure URLs are served by hosts with the right set of privileges.
|
2020-10-21 00:47:04 +00:00
|
|
|
enum class RenderProcessHostPrivilege {
|
2020-10-27 17:51:45 +00:00
|
|
|
kNormal,
|
|
|
|
kHosted,
|
|
|
|
kIsolated,
|
|
|
|
kExtension,
|
2020-02-06 21:42:34 +00:00
|
|
|
};
|
|
|
|
|
2021-05-14 12:06:55 +00:00
|
|
|
// Copied from chrome/browser/extensions/extension_util.cc.
|
|
|
|
bool AllowFileAccess(const std::string& extension_id,
|
|
|
|
content::BrowserContext* context) {
|
|
|
|
return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
2023-03-16 10:03:53 +00:00
|
|
|
extensions::switches::kDisableExtensionsFileAccessCheck) ||
|
2021-05-14 12:06:55 +00:00
|
|
|
extensions::ExtensionPrefs::Get(context)->AllowFileAccess(
|
|
|
|
extension_id);
|
|
|
|
}
|
|
|
|
|
2020-02-06 21:42:34 +00:00
|
|
|
RenderProcessHostPrivilege GetPrivilegeRequiredByUrl(
|
|
|
|
const GURL& url,
|
|
|
|
extensions::ExtensionRegistry* registry) {
|
|
|
|
// Default to a normal renderer cause it is lower privileged. This should only
|
|
|
|
// occur if the URL on a site instance is either malformed, or uninitialized.
|
|
|
|
// If it is malformed, then there is no need for better privileges anyways.
|
|
|
|
// If it is uninitialized, but eventually settles on being an a scheme other
|
|
|
|
// than normal webrenderer, the navigation logic will correct us out of band
|
|
|
|
// anyways.
|
|
|
|
if (!url.is_valid())
|
2020-10-27 17:51:45 +00:00
|
|
|
return RenderProcessHostPrivilege::kNormal;
|
2020-02-06 21:42:34 +00:00
|
|
|
|
|
|
|
if (!url.SchemeIs(extensions::kExtensionScheme))
|
2020-10-27 17:51:45 +00:00
|
|
|
return RenderProcessHostPrivilege::kNormal;
|
2020-02-06 21:42:34 +00:00
|
|
|
|
2020-10-27 17:51:45 +00:00
|
|
|
return RenderProcessHostPrivilege::kExtension;
|
2020-02-06 21:42:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RenderProcessHostPrivilege GetProcessPrivilege(
|
|
|
|
content::RenderProcessHost* process_host,
|
2024-06-07 21:18:35 +00:00
|
|
|
extensions::ProcessMap* process_map) {
|
|
|
|
std::optional<extensions::ExtensionId> extension_id =
|
|
|
|
process_map->GetExtensionIdForProcess(process_host->GetID());
|
|
|
|
if (!extension_id.has_value())
|
2020-10-27 17:51:45 +00:00
|
|
|
return RenderProcessHostPrivilege::kNormal;
|
2020-02-06 21:42:34 +00:00
|
|
|
|
2020-10-27 17:51:45 +00:00
|
|
|
return RenderProcessHostPrivilege::kExtension;
|
2020-02-06 21:42:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const extensions::Extension* GetEnabledExtensionFromEffectiveURL(
|
|
|
|
content::BrowserContext* context,
|
|
|
|
const GURL& effective_url) {
|
|
|
|
if (!effective_url.SchemeIs(extensions::kExtensionScheme))
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
extensions::ExtensionRegistry* registry =
|
|
|
|
extensions::ExtensionRegistry::Get(context);
|
|
|
|
if (!registry)
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return registry->enabled_extensions().GetByID(effective_url.host());
|
|
|
|
}
|
|
|
|
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2020-05-07 20:31:26 +00:00
|
|
|
int GetCrashSignalFD(const base::CommandLine& command_line) {
|
2022-10-17 14:22:24 +00:00
|
|
|
int fd;
|
|
|
|
return crash_reporter::GetHandlerSocket(&fd, nullptr) ? fd : -1;
|
2020-05-07 20:31:26 +00:00
|
|
|
}
|
2022-02-10 02:58:52 +00:00
|
|
|
#endif // BUILDFLAG(IS_LINUX)
|
2020-05-07 20:31:26 +00:00
|
|
|
|
2022-03-09 15:15:50 +00:00
|
|
|
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) {
|
|
|
|
// |allowlist| combines pref/policy + cmdline switch in the browser process.
|
|
|
|
// For renderer and utility (e.g. NetworkService) processes the switch is the
|
|
|
|
// only available source, so below the combined (pref/policy + cmdline)
|
|
|
|
// allowlist of secure origins is injected into |cmdline| for these other
|
|
|
|
// processes.
|
|
|
|
std::vector<std::string> allowlist =
|
|
|
|
network::SecureOriginAllowlist::GetInstance().GetCurrentAllowlist();
|
|
|
|
if (!allowlist.empty()) {
|
|
|
|
cmdline->AppendSwitchASCII(
|
|
|
|
network::switches::kUnsafelyTreatInsecureOriginAsSecure,
|
|
|
|
base::JoinString(allowlist, ","));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-31 02:30:16 +00:00
|
|
|
} // namespace
|
|
|
|
|
2015-05-11 06:40:40 +00:00
|
|
|
// static
|
2018-10-23 08:45:41 +00:00
|
|
|
ElectronBrowserClient* ElectronBrowserClient::Get() {
|
|
|
|
return g_browser_client;
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
void ElectronBrowserClient::SetApplicationLocale(const std::string& locale) {
|
|
|
|
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
|
2022-05-17 16:48:40 +00:00
|
|
|
!content::GetIOThreadTaskRunner({})->PostTask(
|
|
|
|
FROM_HERE, base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) {
|
2024-01-12 13:50:29 +00:00
|
|
|
*g_io_thread_application_locale = locale;
|
2018-10-23 08:45:41 +00:00
|
|
|
}
|
|
|
|
*g_application_locale = locale;
|
|
|
|
}
|
|
|
|
|
|
|
|
ElectronBrowserClient::ElectronBrowserClient() {
|
|
|
|
DCHECK(!g_browser_client);
|
|
|
|
g_browser_client = this;
|
|
|
|
}
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2018-10-23 08:45:41 +00:00
|
|
|
ElectronBrowserClient::~ElectronBrowserClient() {
|
|
|
|
DCHECK(g_browser_client);
|
|
|
|
g_browser_client = nullptr;
|
|
|
|
}
|
2013-04-12 01:46:58 +00:00
|
|
|
|
2016-05-27 00:20:46 +00:00
|
|
|
content::WebContents* ElectronBrowserClient::GetWebContentsFromProcessID(
|
|
|
|
int process_id) {
|
2017-07-10 22:48:12 +00:00
|
|
|
// If the process is a pending process, we should use the web contents
|
2018-12-05 08:03:39 +00:00
|
|
|
// for the frame host passed into RegisterPendingProcess.
|
2019-08-28 14:39:21 +00:00
|
|
|
const auto iter = pending_processes_.find(process_id);
|
|
|
|
if (iter != std::end(pending_processes_))
|
|
|
|
return iter->second;
|
2016-05-27 00:20:46 +00:00
|
|
|
|
|
|
|
// Certain render process will be created with no associated render view,
|
|
|
|
// for example: ServiceWorker.
|
|
|
|
return WebContentsPreferences::GetWebContentsFromProcessID(process_id);
|
|
|
|
}
|
|
|
|
|
2018-12-05 08:03:39 +00:00
|
|
|
content::SiteInstance* ElectronBrowserClient::GetSiteInstanceFromAffinity(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const GURL& url,
|
|
|
|
content::RenderFrameHost* rfh) const {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-06-20 10:10:56 +00:00
|
|
|
bool ElectronBrowserClient::IsRendererSubFrame(int process_id) const {
|
2019-07-03 01:22:09 +00:00
|
|
|
return base::Contains(renderer_is_subframe_, process_id);
|
2019-06-20 10:10:56 +00:00
|
|
|
}
|
|
|
|
|
2014-08-21 13:19:43 +00:00
|
|
|
void ElectronBrowserClient::RenderProcessWillLaunch(
|
2019-08-15 20:50:58 +00:00
|
|
|
content::RenderProcessHost* host) {
|
2022-06-03 00:23:01 +00:00
|
|
|
// Remove in case the host is reused after a crash, otherwise noop.
|
|
|
|
host->RemoveObserver(this);
|
|
|
|
|
2017-03-19 08:25:45 +00:00
|
|
|
// ensure the ProcessPreferences is removed later
|
|
|
|
host->AddObserver(this);
|
2014-08-21 13:19:43 +00:00
|
|
|
}
|
|
|
|
|
2014-10-08 03:55:14 +00:00
|
|
|
content::SpeechRecognitionManagerDelegate*
|
2018-04-18 01:55:30 +00:00
|
|
|
ElectronBrowserClient::CreateSpeechRecognitionManagerDelegate() {
|
2014-10-08 03:55:14 +00:00
|
|
|
return new ElectronSpeechRecognitionManagerDelegate;
|
|
|
|
}
|
|
|
|
|
2020-07-14 01:13:34 +00:00
|
|
|
content::TtsPlatform* ElectronBrowserClient::GetTtsPlatform() {
|
2019-01-10 00:44:44 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
void ElectronBrowserClient::OverrideWebkitPrefs(
|
2021-02-09 20:16:21 +00:00
|
|
|
content::WebContents* web_contents,
|
2020-09-21 08:00:36 +00:00
|
|
|
blink::web_pref::WebPreferences* prefs) {
|
2013-04-12 12:48:02 +00:00
|
|
|
prefs->javascript_enabled = true;
|
2014-03-04 13:23:18 +00:00
|
|
|
prefs->web_security_enabled = true;
|
2014-10-26 06:05:54 +00:00
|
|
|
prefs->plugins_enabled = true;
|
2013-04-12 12:48:02 +00:00
|
|
|
prefs->dom_paste_enabled = true;
|
|
|
|
prefs->allow_scripts_to_close_windows = true;
|
|
|
|
prefs->javascript_can_access_clipboard = true;
|
|
|
|
prefs->local_storage_enabled = true;
|
|
|
|
prefs->databases_enabled = true;
|
2023-11-09 18:23:52 +00:00
|
|
|
prefs->allow_universal_access_from_file_urls =
|
|
|
|
electron::fuses::IsGrantFileProtocolExtraPrivilegesEnabled();
|
|
|
|
prefs->allow_file_access_from_file_urls =
|
|
|
|
electron::fuses::IsGrantFileProtocolExtraPrivilegesEnabled();
|
2017-12-18 01:47:10 +00:00
|
|
|
prefs->webgl1_enabled = true;
|
|
|
|
prefs->webgl2_enabled = true;
|
2015-01-07 04:53:25 +00:00
|
|
|
prefs->allow_running_insecure_content = false;
|
2018-04-26 15:27:35 +00:00
|
|
|
prefs->default_minimum_page_scale_factor = 1.f;
|
|
|
|
prefs->default_maximum_page_scale_factor = 1.f;
|
chore: bump chromium to 118.0.5975.0 (main) (#39531)
* chore: bump chromium in DEPS to 118.0.5951.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894
No logic changes, but patch needed to be manually re-applied due to upstream code shear
* chore: update port_autofill_colors_to_the_color_pipeline.patch
No manual changes; patch applied with fuzz
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5953.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5955.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5957.0
* chore: update patches
* chore: include path of native_web_keyboard_event.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
* chore: remove reference to eextensions/browser/notification-types.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627
* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?
* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198
* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277
Exiting upstream code used by chromium_src now depends on this new upstream class
* chore: bump chromium in DEPS to 118.0.5959.0
* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
manually adjust patch to minor upstream chagnes
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5961.0
* chore: bump chromium in DEPS to 118.0.5963.0
* chore: update patches
* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994
* Many files moved from `mac` -> `apple`
This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too
* fixup minor patch update error
A function param got dropped from this patch somewhere earlier
* chore: bump chromium in DEPS to 118.0.5965.2
* chore: update patches
* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213
* Fix removed include to BrowserContext
In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.
* chore: bump chromium in DEPS to 118.0.5967.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5969.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5971.0
* chore: bump chromium in DEPS to 118.0.5973.0
* chore: update patches
* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121
* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164
* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488
Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.
* chore: bump chromium in DEPS to 118.0.5975.0
* chore: update patches
* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build
* Reland "[windows] Remove RegKey::DeleteEmptyKey"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255
* Ensure StrCat means StrCat
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180
* fixup! Remove RegKey::DeleteEmptyKey
* Consistently reject large p and large q in DH
Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-01 06:54:59 +00:00
|
|
|
|
|
|
|
blink::RendererPreferences* renderer_prefs =
|
|
|
|
web_contents->GetMutableRendererPrefs();
|
|
|
|
renderer_prefs->can_accept_load_drops = false;
|
2014-03-06 03:07:04 +00:00
|
|
|
|
2020-03-30 22:39:50 +00:00
|
|
|
ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
|
2024-07-10 22:14:02 +00:00
|
|
|
prefs->in_forced_colors = native_theme->InForcedColorsMode();
|
2020-10-16 01:30:41 +00:00
|
|
|
prefs->preferred_color_scheme =
|
|
|
|
native_theme->ShouldUseDarkColors()
|
|
|
|
? blink::mojom::PreferredColorScheme::kDark
|
|
|
|
: blink::mojom::PreferredColorScheme::kLight;
|
2020-03-30 22:39:50 +00:00
|
|
|
|
2018-11-08 14:51:51 +00:00
|
|
|
SetFontDefaults(prefs);
|
|
|
|
|
2014-12-18 02:13:39 +00:00
|
|
|
// Custom preferences of guest page.
|
2018-03-08 08:01:54 +00:00
|
|
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
2020-11-10 17:06:03 +00:00
|
|
|
if (web_preferences) {
|
chore: bump chromium to 118.0.5975.0 (main) (#39531)
* chore: bump chromium in DEPS to 118.0.5951.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894
No logic changes, but patch needed to be manually re-applied due to upstream code shear
* chore: update port_autofill_colors_to_the_color_pipeline.patch
No manual changes; patch applied with fuzz
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5953.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5955.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5957.0
* chore: update patches
* chore: include path of native_web_keyboard_event.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
* chore: remove reference to eextensions/browser/notification-types.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627
* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?
* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198
* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277
Exiting upstream code used by chromium_src now depends on this new upstream class
* chore: bump chromium in DEPS to 118.0.5959.0
* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
manually adjust patch to minor upstream chagnes
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5961.0
* chore: bump chromium in DEPS to 118.0.5963.0
* chore: update patches
* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994
* Many files moved from `mac` -> `apple`
This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too
* fixup minor patch update error
A function param got dropped from this patch somewhere earlier
* chore: bump chromium in DEPS to 118.0.5965.2
* chore: update patches
* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213
* Fix removed include to BrowserContext
In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.
* chore: bump chromium in DEPS to 118.0.5967.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5969.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5971.0
* chore: bump chromium in DEPS to 118.0.5973.0
* chore: update patches
* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121
* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164
* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488
Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.
* chore: bump chromium in DEPS to 118.0.5975.0
* chore: update patches
* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build
* Reland "[windows] Remove RegKey::DeleteEmptyKey"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255
* Ensure StrCat means StrCat
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180
* fixup! Remove RegKey::DeleteEmptyKey
* Consistently reject large p and large q in DH
Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-01 06:54:59 +00:00
|
|
|
web_preferences->OverrideWebkitPrefs(prefs, renderer_prefs);
|
2020-11-10 17:06:03 +00:00
|
|
|
}
|
2013-04-12 12:48:02 +00:00
|
|
|
}
|
|
|
|
|
2018-12-05 08:03:39 +00:00
|
|
|
void ElectronBrowserClient::RegisterPendingSiteInstance(
|
|
|
|
content::RenderFrameHost* rfh,
|
|
|
|
content::SiteInstance* pending_site_instance) {
|
|
|
|
// Remember the original web contents for the pending renderer process.
|
|
|
|
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
|
|
|
auto* pending_process = pending_site_instance->GetProcess();
|
|
|
|
pending_processes_[pending_process->GetID()] = web_contents;
|
2019-06-20 10:10:56 +00:00
|
|
|
|
|
|
|
if (rfh->GetParent())
|
|
|
|
renderer_is_subframe_.insert(pending_process->GetID());
|
|
|
|
else
|
|
|
|
renderer_is_subframe_.erase(pending_process->GetID());
|
2017-12-13 10:57:41 +00:00
|
|
|
}
|
2016-05-23 03:57:46 +00:00
|
|
|
|
2014-01-30 13:57:01 +00:00
|
|
|
void ElectronBrowserClient::AppendExtraCommandLineSwitches(
|
2014-06-28 14:33:00 +00:00
|
|
|
base::CommandLine* command_line,
|
2015-06-03 05:45:06 +00:00
|
|
|
int process_id) {
|
2018-01-22 22:49:30 +00:00
|
|
|
// Make sure we're about to launch a known executable
|
2024-05-07 14:04:50 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
|
|
|
// On Linux, do not perform this check for /proc/self/exe. It will always
|
|
|
|
// point to the currently running executable so this check is not
|
|
|
|
// necessary, and if the executable has been deleted it will return a fake
|
|
|
|
// name that causes this check to fail.
|
|
|
|
if (command_line->GetProgram() != base::FilePath(base::kProcSelfExe)) {
|
|
|
|
#else
|
2018-01-23 15:25:01 +00:00
|
|
|
{
|
2024-05-07 14:04:50 +00:00
|
|
|
#endif
|
2022-11-17 19:59:23 +00:00
|
|
|
ScopedAllowBlockingForElectron allow_blocking;
|
2018-01-23 15:25:01 +00:00
|
|
|
base::FilePath child_path;
|
2019-07-24 22:58:51 +00:00
|
|
|
base::FilePath program =
|
|
|
|
base::MakeAbsoluteFilePath(command_line->GetProgram());
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2019-07-24 22:58:51 +00:00
|
|
|
auto renderer_child_path = content::ChildProcessHost::GetChildPath(
|
|
|
|
content::ChildProcessHost::CHILD_RENDERER);
|
|
|
|
auto gpu_child_path = content::ChildProcessHost::GetChildPath(
|
|
|
|
content::ChildProcessHost::CHILD_GPU);
|
|
|
|
auto plugin_child_path = content::ChildProcessHost::GetChildPath(
|
|
|
|
content::ChildProcessHost::CHILD_PLUGIN);
|
2023-01-21 00:42:45 +00:00
|
|
|
if (program != renderer_child_path && program != gpu_child_path &&
|
|
|
|
program != plugin_child_path) {
|
2019-07-24 22:58:51 +00:00
|
|
|
child_path = content::ChildProcessHost::GetChildPath(
|
|
|
|
content::ChildProcessHost::CHILD_NORMAL);
|
|
|
|
CHECK_EQ(program, child_path)
|
|
|
|
<< "Aborted from launching unexpected helper executable";
|
2019-07-03 01:22:09 +00:00
|
|
|
}
|
|
|
|
#else
|
2021-02-19 23:08:49 +00:00
|
|
|
if (!base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path)) {
|
|
|
|
CHECK(false) << "Unable to get child process binary name.";
|
|
|
|
}
|
|
|
|
SCOPED_CRASH_KEY_STRING256("ChildProcess", "child_process_exe",
|
|
|
|
child_path.AsUTF8Unsafe());
|
|
|
|
SCOPED_CRASH_KEY_STRING256("ChildProcess", "program",
|
|
|
|
program.AsUTF8Unsafe());
|
2019-07-24 22:58:51 +00:00
|
|
|
CHECK_EQ(program, child_path);
|
2019-07-03 01:22:09 +00:00
|
|
|
#endif
|
2018-01-23 15:25:01 +00:00
|
|
|
}
|
2018-01-22 22:49:30 +00:00
|
|
|
|
2017-07-07 22:14:25 +00:00
|
|
|
std::string process_type =
|
|
|
|
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
2015-04-26 09:26:25 +00:00
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2022-10-17 14:22:24 +00:00
|
|
|
pid_t pid;
|
|
|
|
if (crash_reporter::GetHandlerSocket(nullptr, &pid)) {
|
|
|
|
command_line->AppendSwitchASCII(
|
|
|
|
crash_reporter::switches::kCrashpadHandlerPid,
|
|
|
|
base::NumberToString(pid));
|
2021-07-19 17:11:10 +00:00
|
|
|
}
|
|
|
|
|
2021-11-04 17:45:59 +00:00
|
|
|
// Zygote Process gets booted before any JS runs, accessing GetClientId
|
|
|
|
// will end up touching DIR_USER_DATA path provider and this will
|
|
|
|
// configure default value because app.name from browser_init has
|
|
|
|
// not run yet.
|
2022-10-17 14:22:24 +00:00
|
|
|
if (process_type != ::switches::kZygoteProcess) {
|
2020-08-07 22:30:49 +00:00
|
|
|
std::string switch_value =
|
|
|
|
api::crash_reporter::GetClientId() + ",no_channel";
|
|
|
|
command_line->AppendSwitchASCII(::switches::kEnableCrashReporter,
|
|
|
|
switch_value);
|
2020-05-07 20:31:26 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-06-17 21:17:25 +00:00
|
|
|
// The zygote process is booted before JS runs, so DIR_USER_DATA isn't usable
|
|
|
|
// at that time. It doesn't need --user-data-dir to be correct anyway, since
|
|
|
|
// the zygote itself doesn't access anything in that directory.
|
|
|
|
if (process_type != ::switches::kZygoteProcess) {
|
|
|
|
base::FilePath user_data_dir;
|
|
|
|
if (base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
|
|
|
|
command_line->AppendSwitchPath(::switches::kUserDataDir, user_data_dir);
|
|
|
|
}
|
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
if (process_type == ::switches::kUtilityProcess ||
|
|
|
|
process_type == ::switches::kRendererProcess) {
|
|
|
|
// Copy following switches to child process.
|
|
|
|
static const char* const kCommonSwitchNames[] = {
|
|
|
|
switches::kStandardSchemes, switches::kEnableSandbox,
|
|
|
|
switches::kSecureSchemes, switches::kBypassCSPSchemes,
|
|
|
|
switches::kCORSSchemes, switches::kFetchSchemes,
|
2023-12-06 02:22:41 +00:00
|
|
|
switches::kServiceWorkerSchemes, switches::kStreamingSchemes,
|
|
|
|
switches::kCodeCacheSchemes};
|
2019-10-28 22:12:35 +00:00
|
|
|
command_line->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
|
2023-07-31 17:47:32 +00:00
|
|
|
kCommonSwitchNames);
|
2022-03-09 15:15:50 +00:00
|
|
|
if (process_type == ::switches::kUtilityProcess ||
|
|
|
|
content::RenderProcessHost::FromID(process_id)) {
|
|
|
|
MaybeAppendSecureOriginsAllowlistSwitch(command_line);
|
|
|
|
}
|
2019-10-28 22:12:35 +00:00
|
|
|
}
|
2016-06-08 06:46:50 +00:00
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
if (process_type == ::switches::kRendererProcess) {
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2019-10-28 22:12:35 +00:00
|
|
|
// Append --app-user-model-id.
|
|
|
|
PWSTR current_app_id;
|
|
|
|
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(¤t_app_id))) {
|
|
|
|
command_line->AppendSwitchNative(switches::kAppUserModelId,
|
|
|
|
current_app_id);
|
|
|
|
CoTaskMemFree(current_app_id);
|
|
|
|
}
|
2015-08-04 09:13:05 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
if (delegate_) {
|
|
|
|
auto app_path = static_cast<api::App*>(delegate_)->GetAppPath();
|
|
|
|
command_line->AppendSwitchPath(switches::kAppPath, app_path);
|
|
|
|
}
|
2017-04-04 00:36:01 +00:00
|
|
|
|
2021-06-04 00:23:06 +00:00
|
|
|
auto env = base::Environment::Create();
|
2020-06-01 23:08:34 +00:00
|
|
|
if (env->HasVar("ELECTRON_PROFILE_INIT_SCRIPTS")) {
|
|
|
|
command_line->AppendSwitch("profile-electron-init");
|
|
|
|
}
|
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
content::WebContents* web_contents =
|
|
|
|
GetWebContentsFromProcessID(process_id);
|
|
|
|
if (web_contents) {
|
|
|
|
auto* web_preferences = WebContentsPreferences::From(web_contents);
|
|
|
|
if (web_preferences)
|
|
|
|
web_preferences->AppendCommandLineSwitches(
|
|
|
|
command_line, IsRendererSubFrame(process_id));
|
2019-05-31 22:47:18 +00:00
|
|
|
}
|
2017-12-05 06:59:15 +00:00
|
|
|
}
|
2014-01-30 13:57:01 +00:00
|
|
|
}
|
|
|
|
|
2018-10-31 14:49:44 +00:00
|
|
|
// attempt to get api key from env
|
2018-03-14 07:55:59 +00:00
|
|
|
std::string ElectronBrowserClient::GetGeolocationApiKey() {
|
2021-06-04 00:23:06 +00:00
|
|
|
auto env = base::Environment::Create();
|
2018-03-14 07:55:59 +00:00
|
|
|
std::string api_key;
|
2018-10-31 14:49:44 +00:00
|
|
|
env->GetVar("GOOGLE_API_KEY", &api_key);
|
2018-03-14 07:55:59 +00:00
|
|
|
return api_key;
|
|
|
|
}
|
|
|
|
|
2019-01-09 20:16:33 +00:00
|
|
|
content::GeneratedCodeCacheSettings
|
|
|
|
ElectronBrowserClient::GetGeneratedCodeCacheSettings(
|
|
|
|
content::BrowserContext* context) {
|
|
|
|
// TODO(deepak1556): Use platform cache directory.
|
|
|
|
base::FilePath cache_path = context->GetPath();
|
|
|
|
// If we pass 0 for size, disk_cache will pick a default size using the
|
|
|
|
// heuristics based on available disk size. These are implemented in
|
|
|
|
// disk_cache::PreferredCacheSize in net/disk_cache/cache_util.cc.
|
|
|
|
return content::GeneratedCodeCacheSettings(true, 0, cache_path);
|
|
|
|
}
|
|
|
|
|
2015-11-18 02:39:25 +00:00
|
|
|
void ElectronBrowserClient::AllowCertificateError(
|
2016-03-08 14:28:53 +00:00
|
|
|
content::WebContents* web_contents,
|
2015-11-18 02:39:25 +00:00
|
|
|
int cert_error,
|
|
|
|
const net::SSLInfo& ssl_info,
|
|
|
|
const GURL& request_url,
|
2019-05-13 21:24:39 +00:00
|
|
|
bool is_main_frame_request,
|
2015-11-18 02:39:25 +00:00
|
|
|
bool strict_enforcement,
|
2019-12-11 00:22:35 +00:00
|
|
|
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
|
2015-11-18 02:39:25 +00:00
|
|
|
if (delegate_) {
|
2019-08-15 20:50:58 +00:00
|
|
|
delegate_->AllowCertificateError(web_contents, cert_error, ssl_info,
|
|
|
|
request_url, is_main_frame_request,
|
2019-12-11 00:22:35 +00:00
|
|
|
strict_enforcement, std::move(callback));
|
2015-11-18 02:39:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-03 01:22:09 +00:00
|
|
|
base::OnceClosure ElectronBrowserClient::SelectClientCertificate(
|
2023-07-20 07:36:59 +00:00
|
|
|
content::BrowserContext* browser_context,
|
chore: bump chromium to 128.0.6611.0 (main) (#42779)
* chore: bump chromium in DEPS to 128.0.6577.0
* chore: bump chromium in DEPS to 128.0.6579.0
* 5675706: Reland "Reland "Reland "Reland "Add toolchains without PartitionAlloc-Everywhere for dump_syms et al""""
https://chromium-review.googlesource.com/c/chromium/src/+/5675706
* 5668597: [PDF Ink Signatures] Prompt download menu on save when there are edits
https://chromium-review.googlesource.com/c/chromium/src/+/5668597
* 5677014: Reland "Pull data_sharing_sdk from CIPD"
https://chromium-review.googlesource.com/c/chromium/src/+/5677014
* chore: fixup patch indices
* chore: bump chromium in DEPS to 128.0.6581.0
* chore: bump chromium in DEPS to 128.0.6583.0
* update patches
* 5455480: [Extensions] Allow service worker requests to continue without a cert
https://chromium-review.googlesource.com/c/chromium/src/+/5455480
* try to get some debugging output from script/push-patch.js
* chore: bump chromium in DEPS to 128.0.6585.0
* chore: bump chromium in DEPS to 128.0.6587.0
* update patches
* chore: bump chromium in DEPS to 128.0.6589.0
* more patch work
* maybe over here?
* chore: update patches
* 5673207: [HTTPS Upgrades] Disable in captive portal login webview
https://chromium-review.googlesource.com/c/chromium/src/+/5673207
* 5636785: Extensions: WAR: manifest.json's use_dynamic_url requires a dynamic url
https://chromium-review.googlesource.com/c/chromium/src/+/5636785
* chore: bump chromium in DEPS to 128.0.6591.0
* 5665458: Trigger WN2 page when feature is enabled
https://chromium-review.googlesource.com/c/chromium/src/+/5665458
* update patches
* chore: bump chromium in DEPS to 128.0.6593.0
* chore: bump chromium in DEPS to 128.0.6595.0
* chore: bump chromium in DEPS to 128.0.6597.0
* (patch update) 5694586: [compile hints] Remove the usage of v8::Isolate::SetJavaScriptCompileHintsMagicEnabledCallback API
https://chromium-review.googlesource.com/c/chromium/src/+/5694586
* update patches
* 5691287: Reland "Change blink::WebKeyboardEvent to use std::array in is members"
https://chromium-review.googlesource.com/c/chromium/src/+/5691287
The code changed here is modeled after code in `content/renderer/pepper/event_conversion.cc` that was also modified in this CL, so I took the same approach.
* 5529018: Cleanup EnableWebHidOnExtensionServiceWorker flag
https://chromium-review.googlesource.com/c/chromium/src/+/5529018
* 5526324: [Code Health] Add deprecation comment for base::SupportsWeakPtr.
https://chromium-review.googlesource.com/c/chromium/src/+/5526324
Note that this CL actually does make `SupportsWeakPtr` strictly restricted to existing implementations, no new ones. We could add a patch to add ourselves to this list, but it looks like we'll have to refactor this anyways in the near future. Since the refactor seems straightforward, let's try that first.
* chore: bump chromium in DEPS to 128.0.6598.0
* chore: update patches
* 5704737: Rename ExclusiveAccessContext::GetActiveWebContents to avoid conflict
https://chromium-review.googlesource.com/c/chromium/src/+/5704737
* chore: bump chromium in DEPS to 128.0.6601.0
* chore: update patches
* Add `base::StringPiece` header includes
Chromium is working on replacing `base::StringPiece` with `std::string_view`. (See the Chromium Bug below.) They're currently running mass codemods (across many multiple changes) to replace uses of `StringPiece` with `string_view`, including removing the header include for `StringPiece` in those files. This cascades down to our files that were implicitly depending on those includes through some other include.
They're on track to eventually deprecate and remove `StringPiece` so our code should be converted, but that can be done as an upgrade follow-up task. For now, adding the header back to files that need it should suffice for minimal upgrade changes.
Chromium Bug: https://issues.chromium.org/issues/40506050
* 5702737: GlobalRequestID: Avoid unwanted inlining and narrowing int conversions
https://chromium-review.googlesource.com/c/chromium/src/+/5702737
contender for smallest commit 2024
* 5706534: Rename GlobalFeatures to GlobalDesktopFeatures.
https://chromium-review.googlesource.com/c/chromium/src/+/5706534
* 5691321: ui: remove params variants of SelectFile listener functions
https://chromium-review.googlesource.com/c/chromium/src/+/5691321
* 5714949: [Extensions] Display re-enable dialog for MV2 disabled stage
https://chromium-review.googlesource.com/c/chromium/src/+/5714949
* chore: update libc++ filenames
* patch: disable scope reuse & associated dchecks in v8 (hopefully temp, upgrade follow-up)
* fixup! Add `base::StringPiece` header includes
* update MAS patch
5710330: Add crash keys to debug NativeWidgetMacNSWindowBorderlessFrame exception
https://chromium-review.googlesource.com/c/chromium/src/+/5710330
* chore: bump chromium in DEPS to 128.0.6603.0
* chore: update patches
* 5713258: Reland "Preparation for decoupling creation/initialization of context"
https://chromium-review.googlesource.com/c/chromium/src/+/5713258
When destroying a context, it must already be shutdown, and this change enforces it with a new CHECK.
We were overriding `BrowserContextKeyedServiceFactory::BrowserContextShutdown` with an empty implementation, which differed from the default implementation that notifies the `KeyedServiceFactory` that the context has shutdown. Since we were missing this notification, the CHECK would later trip when the service was being destoryed because it was not registered as shutdown when it was shutdown.
* chore: bump chromium in DEPS to 128.0.6605.2
* chore: update patches
* refactor: linux open/save dialog patch
Our existing implementation was relying on an opaque `void* params` parameter that was passed through `ui::SelectFileDialog`.
Recently, that parameter has been getting removed:
- 5691321: ui: remove params variants of SelectFile listener functions | https://chromium-review.googlesource.com/c/chromium/src/+/5691321
- 5709097: ui: remove SelectFileDialog impl params | https://chromium-review.googlesource.com/c/chromium/src/+/5709097
- https://issues.chromium.org/issues/340178601 "reconsider SelectFileDialog"
This restructures the patch to work with mostly the same mechanics, but directly on the `ui::SelectFileDialog` object. This nets us some wins in terms of a smaller patch.
* 5713262: DevTools UI binding AIDA client event returns response
https://chromium-review.googlesource.com/c/chromium/src/+/5713262
* fixup! refactor: linux open/save dialog patch
* chore: bump chromium in DEPS to 128.0.6606.0
* chore: update patches
* fixup! refactor: linux open/save dialog patch
* chore: bump chromium in DEPS to 128.0.6607.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5722937
* fix: pwd error in electron-test, nan-test
fix: unshallow depot_tools before 3-way apply
* chore: e patches all
* fixup! fix: pwd error in electron-test, nan-test
* chore: bump chromium in DEPS to 128.0.6609.0
* chore: bump chromium in DEPS to 128.0.6611.0
* chore: update patches
* chore: update libcxx filenames
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Alice Zhao <alice@makenotion.com>
2024-07-23 15:59:44 +00:00
|
|
|
int process_id,
|
2015-06-03 20:57:06 +00:00
|
|
|
content::WebContents* web_contents,
|
|
|
|
net::SSLCertRequestInfo* cert_request_info,
|
2017-08-20 21:35:04 +00:00
|
|
|
net::ClientCertIdentityList client_certs,
|
2016-05-23 01:59:39 +00:00
|
|
|
std::unique_ptr<content::ClientCertificateDelegate> delegate) {
|
2023-07-20 07:36:59 +00:00
|
|
|
if (client_certs.empty()) {
|
|
|
|
delegate->ContinueWithCertificate(nullptr, nullptr);
|
|
|
|
} else if (delegate_) {
|
|
|
|
delegate_->SelectClientCertificate(
|
chore: bump chromium to 128.0.6611.0 (main) (#42779)
* chore: bump chromium in DEPS to 128.0.6577.0
* chore: bump chromium in DEPS to 128.0.6579.0
* 5675706: Reland "Reland "Reland "Reland "Add toolchains without PartitionAlloc-Everywhere for dump_syms et al""""
https://chromium-review.googlesource.com/c/chromium/src/+/5675706
* 5668597: [PDF Ink Signatures] Prompt download menu on save when there are edits
https://chromium-review.googlesource.com/c/chromium/src/+/5668597
* 5677014: Reland "Pull data_sharing_sdk from CIPD"
https://chromium-review.googlesource.com/c/chromium/src/+/5677014
* chore: fixup patch indices
* chore: bump chromium in DEPS to 128.0.6581.0
* chore: bump chromium in DEPS to 128.0.6583.0
* update patches
* 5455480: [Extensions] Allow service worker requests to continue without a cert
https://chromium-review.googlesource.com/c/chromium/src/+/5455480
* try to get some debugging output from script/push-patch.js
* chore: bump chromium in DEPS to 128.0.6585.0
* chore: bump chromium in DEPS to 128.0.6587.0
* update patches
* chore: bump chromium in DEPS to 128.0.6589.0
* more patch work
* maybe over here?
* chore: update patches
* 5673207: [HTTPS Upgrades] Disable in captive portal login webview
https://chromium-review.googlesource.com/c/chromium/src/+/5673207
* 5636785: Extensions: WAR: manifest.json's use_dynamic_url requires a dynamic url
https://chromium-review.googlesource.com/c/chromium/src/+/5636785
* chore: bump chromium in DEPS to 128.0.6591.0
* 5665458: Trigger WN2 page when feature is enabled
https://chromium-review.googlesource.com/c/chromium/src/+/5665458
* update patches
* chore: bump chromium in DEPS to 128.0.6593.0
* chore: bump chromium in DEPS to 128.0.6595.0
* chore: bump chromium in DEPS to 128.0.6597.0
* (patch update) 5694586: [compile hints] Remove the usage of v8::Isolate::SetJavaScriptCompileHintsMagicEnabledCallback API
https://chromium-review.googlesource.com/c/chromium/src/+/5694586
* update patches
* 5691287: Reland "Change blink::WebKeyboardEvent to use std::array in is members"
https://chromium-review.googlesource.com/c/chromium/src/+/5691287
The code changed here is modeled after code in `content/renderer/pepper/event_conversion.cc` that was also modified in this CL, so I took the same approach.
* 5529018: Cleanup EnableWebHidOnExtensionServiceWorker flag
https://chromium-review.googlesource.com/c/chromium/src/+/5529018
* 5526324: [Code Health] Add deprecation comment for base::SupportsWeakPtr.
https://chromium-review.googlesource.com/c/chromium/src/+/5526324
Note that this CL actually does make `SupportsWeakPtr` strictly restricted to existing implementations, no new ones. We could add a patch to add ourselves to this list, but it looks like we'll have to refactor this anyways in the near future. Since the refactor seems straightforward, let's try that first.
* chore: bump chromium in DEPS to 128.0.6598.0
* chore: update patches
* 5704737: Rename ExclusiveAccessContext::GetActiveWebContents to avoid conflict
https://chromium-review.googlesource.com/c/chromium/src/+/5704737
* chore: bump chromium in DEPS to 128.0.6601.0
* chore: update patches
* Add `base::StringPiece` header includes
Chromium is working on replacing `base::StringPiece` with `std::string_view`. (See the Chromium Bug below.) They're currently running mass codemods (across many multiple changes) to replace uses of `StringPiece` with `string_view`, including removing the header include for `StringPiece` in those files. This cascades down to our files that were implicitly depending on those includes through some other include.
They're on track to eventually deprecate and remove `StringPiece` so our code should be converted, but that can be done as an upgrade follow-up task. For now, adding the header back to files that need it should suffice for minimal upgrade changes.
Chromium Bug: https://issues.chromium.org/issues/40506050
* 5702737: GlobalRequestID: Avoid unwanted inlining and narrowing int conversions
https://chromium-review.googlesource.com/c/chromium/src/+/5702737
contender for smallest commit 2024
* 5706534: Rename GlobalFeatures to GlobalDesktopFeatures.
https://chromium-review.googlesource.com/c/chromium/src/+/5706534
* 5691321: ui: remove params variants of SelectFile listener functions
https://chromium-review.googlesource.com/c/chromium/src/+/5691321
* 5714949: [Extensions] Display re-enable dialog for MV2 disabled stage
https://chromium-review.googlesource.com/c/chromium/src/+/5714949
* chore: update libc++ filenames
* patch: disable scope reuse & associated dchecks in v8 (hopefully temp, upgrade follow-up)
* fixup! Add `base::StringPiece` header includes
* update MAS patch
5710330: Add crash keys to debug NativeWidgetMacNSWindowBorderlessFrame exception
https://chromium-review.googlesource.com/c/chromium/src/+/5710330
* chore: bump chromium in DEPS to 128.0.6603.0
* chore: update patches
* 5713258: Reland "Preparation for decoupling creation/initialization of context"
https://chromium-review.googlesource.com/c/chromium/src/+/5713258
When destroying a context, it must already be shutdown, and this change enforces it with a new CHECK.
We were overriding `BrowserContextKeyedServiceFactory::BrowserContextShutdown` with an empty implementation, which differed from the default implementation that notifies the `KeyedServiceFactory` that the context has shutdown. Since we were missing this notification, the CHECK would later trip when the service was being destoryed because it was not registered as shutdown when it was shutdown.
* chore: bump chromium in DEPS to 128.0.6605.2
* chore: update patches
* refactor: linux open/save dialog patch
Our existing implementation was relying on an opaque `void* params` parameter that was passed through `ui::SelectFileDialog`.
Recently, that parameter has been getting removed:
- 5691321: ui: remove params variants of SelectFile listener functions | https://chromium-review.googlesource.com/c/chromium/src/+/5691321
- 5709097: ui: remove SelectFileDialog impl params | https://chromium-review.googlesource.com/c/chromium/src/+/5709097
- https://issues.chromium.org/issues/340178601 "reconsider SelectFileDialog"
This restructures the patch to work with mostly the same mechanics, but directly on the `ui::SelectFileDialog` object. This nets us some wins in terms of a smaller patch.
* 5713262: DevTools UI binding AIDA client event returns response
https://chromium-review.googlesource.com/c/chromium/src/+/5713262
* fixup! refactor: linux open/save dialog patch
* chore: bump chromium in DEPS to 128.0.6606.0
* chore: update patches
* fixup! refactor: linux open/save dialog patch
* chore: bump chromium in DEPS to 128.0.6607.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5722937
* fix: pwd error in electron-test, nan-test
fix: unshallow depot_tools before 3-way apply
* chore: e patches all
* fixup! fix: pwd error in electron-test, nan-test
* chore: bump chromium in DEPS to 128.0.6609.0
* chore: bump chromium in DEPS to 128.0.6611.0
* chore: update patches
* chore: update libcxx filenames
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Alice Zhao <alice@makenotion.com>
2024-07-23 15:59:44 +00:00
|
|
|
browser_context, process_id, web_contents, cert_request_info,
|
2023-07-20 07:36:59 +00:00
|
|
|
std::move(client_certs), std::move(delegate));
|
2015-11-18 02:07:03 +00:00
|
|
|
}
|
2023-07-20 07:36:59 +00:00
|
|
|
|
2019-07-03 01:22:09 +00:00
|
|
|
return base::OnceClosure();
|
2015-06-03 20:57:06 +00:00
|
|
|
}
|
|
|
|
|
2016-03-31 00:58:23 +00:00
|
|
|
bool ElectronBrowserClient::CanCreateWindow(
|
2017-08-04 21:38:06 +00:00
|
|
|
content::RenderFrameHost* opener,
|
2016-03-31 00:58:23 +00:00
|
|
|
const GURL& opener_url,
|
|
|
|
const GURL& opener_top_level_frame_url,
|
2019-01-21 18:14:57 +00:00
|
|
|
const url::Origin& source_origin,
|
2017-04-04 04:50:44 +00:00
|
|
|
content::mojom::WindowContainerType container_type,
|
2016-03-31 00:58:23 +00:00
|
|
|
const GURL& target_url,
|
|
|
|
const content::Referrer& referrer,
|
2016-11-30 07:30:03 +00:00
|
|
|
const std::string& frame_name,
|
2016-03-31 00:58:23 +00:00
|
|
|
WindowOpenDisposition disposition,
|
2017-04-04 04:50:44 +00:00
|
|
|
const blink::mojom::WindowFeatures& features,
|
2020-03-26 18:05:45 +00:00
|
|
|
const std::string& raw_features,
|
2018-04-11 08:42:14 +00:00
|
|
|
const scoped_refptr<network::ResourceRequestBody>& body,
|
2016-03-31 00:58:23 +00:00
|
|
|
bool user_gesture,
|
|
|
|
bool opener_suppressed,
|
|
|
|
bool* no_javascript_access) {
|
2018-03-14 07:55:59 +00:00
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
2016-03-31 14:21:18 +00:00
|
|
|
|
2021-04-23 19:57:40 +00:00
|
|
|
content::WebContents* web_contents =
|
|
|
|
content::WebContents::FromRenderFrameHost(opener);
|
|
|
|
WebContentsPreferences* prefs = WebContentsPreferences::From(web_contents);
|
2022-01-06 17:28:03 +00:00
|
|
|
if (prefs) {
|
2021-07-26 16:04:09 +00:00
|
|
|
if (prefs->ShouldDisablePopups()) {
|
2017-05-23 22:59:17 +00:00
|
|
|
// <webview> without allowpopups attribute should return
|
|
|
|
// null from window.open calls
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
*no_javascript_access = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-31 00:58:23 +00:00
|
|
|
if (delegate_) {
|
2017-12-07 04:12:38 +00:00
|
|
|
return delegate_->CanCreateWindow(
|
|
|
|
opener, opener_url, opener_top_level_frame_url, source_origin,
|
|
|
|
container_type, target_url, referrer, frame_name, disposition, features,
|
2020-03-26 18:05:45 +00:00
|
|
|
raw_features, body, user_gesture, opener_suppressed,
|
2017-12-07 04:12:38 +00:00
|
|
|
no_javascript_access);
|
2016-03-31 00:58:23 +00:00
|
|
|
}
|
2016-03-31 14:21:18 +00:00
|
|
|
|
|
|
|
return false;
|
2016-03-31 00:58:23 +00:00
|
|
|
}
|
|
|
|
|
2022-02-25 18:17:35 +00:00
|
|
|
std::unique_ptr<content::VideoOverlayWindow>
|
|
|
|
ElectronBrowserClient::CreateWindowForVideoPictureInPicture(
|
|
|
|
content::VideoPictureInPictureWindowController* controller) {
|
|
|
|
auto overlay_window = content::VideoOverlayWindow::Create(controller);
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2021-03-18 19:55:51 +00:00
|
|
|
std::wstring app_user_model_id = Browser::Get()->GetAppUserModelID();
|
2020-09-21 08:00:36 +00:00
|
|
|
if (!app_user_model_id.empty()) {
|
2020-10-26 18:56:31 +00:00
|
|
|
auto* overlay_window_view =
|
2022-02-25 18:17:35 +00:00
|
|
|
static_cast<VideoOverlayWindowViews*>(overlay_window.get());
|
|
|
|
ui::win::SetAppIdForWindow(app_user_model_id,
|
|
|
|
overlay_window_view->GetNativeWindow()
|
|
|
|
->GetHost()
|
|
|
|
->GetAcceleratedWidget());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return overlay_window;
|
|
|
|
}
|
2019-08-22 10:17:50 +00:00
|
|
|
|
2016-08-24 00:16:54 +00:00
|
|
|
void ElectronBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
|
|
|
|
std::vector<std::string>* additional_schemes) {
|
2023-12-06 02:22:41 +00:00
|
|
|
const auto& schemes_list = api::GetStandardSchemes();
|
2016-08-24 14:52:35 +00:00
|
|
|
if (!schemes_list.empty())
|
2018-04-18 01:55:30 +00:00
|
|
|
additional_schemes->insert(additional_schemes->end(), schemes_list.begin(),
|
2016-08-24 00:16:54 +00:00
|
|
|
schemes_list.end());
|
2016-09-29 17:20:53 +00:00
|
|
|
additional_schemes->push_back(content::kChromeDevToolsScheme);
|
2020-02-13 00:39:12 +00:00
|
|
|
additional_schemes->push_back(content::kChromeUIScheme);
|
2016-08-24 00:16:54 +00:00
|
|
|
}
|
|
|
|
|
2018-10-19 13:50:30 +00:00
|
|
|
void ElectronBrowserClient::GetAdditionalWebUISchemes(
|
|
|
|
std::vector<std::string>* additional_schemes) {
|
|
|
|
additional_schemes->push_back(content::kChromeDevToolsScheme);
|
|
|
|
}
|
|
|
|
|
2024-01-25 17:46:30 +00:00
|
|
|
void ElectronBrowserClient::SiteInstanceGotProcessAndSite(
|
2020-01-13 22:55:58 +00:00
|
|
|
content::SiteInstance* site_instance) {
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
auto* browser_context =
|
|
|
|
static_cast<ElectronBrowserContext*>(site_instance->GetBrowserContext());
|
2020-05-08 18:17:28 +00:00
|
|
|
if (!browser_context->IsOffTheRecord()) {
|
|
|
|
extensions::ExtensionRegistry* registry =
|
|
|
|
extensions::ExtensionRegistry::Get(browser_context);
|
|
|
|
const extensions::Extension* extension =
|
|
|
|
registry->enabled_extensions().GetExtensionOrAppByURL(
|
|
|
|
site_instance->GetSiteURL());
|
|
|
|
if (!extension)
|
|
|
|
return;
|
|
|
|
|
|
|
|
extensions::ProcessMap::Get(browser_context)
|
2023-05-23 19:58:58 +00:00
|
|
|
->Insert(extension->id(), site_instance->GetProcess()->GetID());
|
2020-05-08 18:17:28 +00:00
|
|
|
}
|
2020-01-13 22:55:58 +00:00
|
|
|
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
}
|
|
|
|
|
2020-02-06 21:42:34 +00:00
|
|
|
bool ElectronBrowserClient::IsSuitableHost(
|
|
|
|
content::RenderProcessHost* process_host,
|
|
|
|
const GURL& site_url) {
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
auto* browser_context = process_host->GetBrowserContext();
|
|
|
|
extensions::ExtensionRegistry* registry =
|
|
|
|
extensions::ExtensionRegistry::Get(browser_context);
|
|
|
|
extensions::ProcessMap* process_map =
|
|
|
|
extensions::ProcessMap::Get(browser_context);
|
|
|
|
|
|
|
|
// Otherwise, just make sure the process privilege matches the privilege
|
|
|
|
// required by the site.
|
|
|
|
RenderProcessHostPrivilege privilege_required =
|
|
|
|
GetPrivilegeRequiredByUrl(site_url, registry);
|
2024-06-07 21:18:35 +00:00
|
|
|
return GetProcessPrivilege(process_host, process_map) == privilege_required;
|
2020-02-06 21:42:34 +00:00
|
|
|
#else
|
|
|
|
return content::ContentBrowserClient::IsSuitableHost(process_host, site_url);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ElectronBrowserClient::ShouldUseProcessPerSite(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const GURL& effective_url) {
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
const extensions::Extension* extension =
|
|
|
|
GetEnabledExtensionFromEffectiveURL(browser_context, effective_url);
|
|
|
|
return extension != nullptr;
|
|
|
|
#else
|
|
|
|
return content::ContentBrowserClient::ShouldUseProcessPerSite(browser_context,
|
|
|
|
effective_url);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-07-01 20:22:55 +00:00
|
|
|
void ElectronBrowserClient::GetMediaDeviceIDSalt(
|
|
|
|
content::RenderFrameHost* rfh,
|
2021-09-01 19:55:07 +00:00
|
|
|
const net::SiteForCookies& site_for_cookies,
|
2023-07-01 20:22:55 +00:00
|
|
|
const blink::StorageKey& storage_key,
|
|
|
|
base::OnceCallback<void(bool, const std::string&)> callback) {
|
|
|
|
constexpr bool persistent_media_device_id_allowed = true;
|
|
|
|
std::string persistent_media_device_id_salt =
|
|
|
|
static_cast<ElectronBrowserContext*>(rfh->GetBrowserContext())
|
|
|
|
->GetMediaDeviceIDSalt();
|
|
|
|
std::move(callback).Run(persistent_media_device_id_allowed,
|
|
|
|
persistent_media_device_id_salt);
|
2020-02-27 00:03:55 +00:00
|
|
|
}
|
|
|
|
|
2021-06-17 21:17:25 +00:00
|
|
|
base::FilePath ElectronBrowserClient::GetLoggingFileName(
|
|
|
|
const base::CommandLine& cmd_line) {
|
|
|
|
return logging::GetLogFileName(cmd_line);
|
|
|
|
}
|
|
|
|
|
2018-04-12 08:48:50 +00:00
|
|
|
std::unique_ptr<net::ClientCertStore>
|
|
|
|
ElectronBrowserClient::CreateClientCertStore(
|
2019-12-11 00:22:35 +00:00
|
|
|
content::BrowserContext* browser_context) {
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(USE_NSS_CERTS)
|
2018-06-19 08:15:54 +00:00
|
|
|
return std::make_unique<net::ClientCertStoreNSS>(
|
2024-07-17 13:48:03 +00:00
|
|
|
base::BindRepeating([](const net::HostPortPair& server) {
|
|
|
|
crypto::CryptoModuleBlockingPasswordDelegate* delegate =
|
|
|
|
new ElectronNSSCryptoModuleDelegate(server);
|
|
|
|
return delegate;
|
|
|
|
}));
|
2022-02-10 02:58:52 +00:00
|
|
|
#elif BUILDFLAG(IS_WIN)
|
2018-06-19 08:15:54 +00:00
|
|
|
return std::make_unique<net::ClientCertStoreWin>();
|
2022-02-10 02:58:52 +00:00
|
|
|
#elif BUILDFLAG(IS_MAC)
|
2018-06-19 08:15:54 +00:00
|
|
|
return std::make_unique<net::ClientCertStoreMac>();
|
2018-04-12 08:48:50 +00:00
|
|
|
#elif defined(USE_OPENSSL)
|
|
|
|
return std::unique_ptr<net::ClientCertStore>();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-08-23 15:51:46 +00:00
|
|
|
std::unique_ptr<device::LocationProvider>
|
|
|
|
ElectronBrowserClient::OverrideSystemLocationProvider() {
|
2018-10-01 20:00:53 +00:00
|
|
|
#if BUILDFLAG(OVERRIDE_LOCATION_PROVIDER)
|
2018-08-23 15:51:46 +00:00
|
|
|
return std::make_unique<FakeLocationProvider>();
|
|
|
|
#else
|
|
|
|
return nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-05-26 20:06:26 +00:00
|
|
|
void ElectronBrowserClient::ConfigureNetworkContextParams(
|
2018-10-04 18:08:56 +00:00
|
|
|
content::BrowserContext* browser_context,
|
2020-05-26 20:06:26 +00:00
|
|
|
bool in_memory,
|
|
|
|
const base::FilePath& relative_partition_path,
|
|
|
|
network::mojom::NetworkContextParams* network_context_params,
|
2021-03-06 00:54:18 +00:00
|
|
|
cert_verifier::mojom::CertVerifierCreationParams*
|
|
|
|
cert_verifier_creation_params) {
|
2019-09-18 19:58:00 +00:00
|
|
|
DCHECK(browser_context);
|
2019-08-02 23:56:46 +00:00
|
|
|
return NetworkContextServiceFactory::GetForContext(browser_context)
|
2020-05-26 20:06:26 +00:00
|
|
|
->ConfigureNetworkContextParams(network_context_params,
|
|
|
|
cert_verifier_creation_params);
|
2019-03-26 01:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
network::mojom::NetworkContext*
|
|
|
|
ElectronBrowserClient::GetSystemNetworkContext() {
|
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
|
DCHECK(g_browser_process->system_network_context_manager());
|
|
|
|
return g_browser_process->system_network_context_manager()->GetContext();
|
2018-10-04 18:08:56 +00:00
|
|
|
}
|
|
|
|
|
2019-06-04 03:44:12 +00:00
|
|
|
std::unique_ptr<content::BrowserMainParts>
|
2022-05-17 16:48:40 +00:00
|
|
|
ElectronBrowserClient::CreateBrowserMainParts(bool /* is_integration_test */) {
|
2024-07-19 16:48:52 +00:00
|
|
|
return std::make_unique<ElectronBrowserMainParts>();
|
2013-04-12 01:46:58 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 16:37:15 +00:00
|
|
|
void ElectronBrowserClient::WebNotificationAllowed(
|
2021-04-29 18:23:28 +00:00
|
|
|
content::RenderFrameHost* rfh,
|
2019-05-29 20:02:15 +00:00
|
|
|
base::OnceCallback<void(bool, bool)> callback) {
|
2016-03-13 22:23:39 +00:00
|
|
|
content::WebContents* web_contents =
|
2021-04-29 18:23:28 +00:00
|
|
|
content::WebContents::FromRenderFrameHost(rfh);
|
2016-01-23 13:29:47 +00:00
|
|
|
if (!web_contents) {
|
2019-05-29 20:02:15 +00:00
|
|
|
std::move(callback).Run(false, false);
|
2016-01-23 13:29:47 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-04-17 22:41:47 +00:00
|
|
|
auto* permission_helper =
|
2016-01-23 13:29:47 +00:00
|
|
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
|
|
|
if (!permission_helper) {
|
2019-05-29 20:02:15 +00:00
|
|
|
std::move(callback).Run(false, false);
|
2016-01-23 13:29:47 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-07-02 07:54:12 +00:00
|
|
|
permission_helper->RequestWebNotificationPermission(
|
2022-08-26 10:31:33 +00:00
|
|
|
rfh, base::BindOnce(std::move(callback), web_contents->IsAudioMuted()));
|
2016-01-23 13:29:47 +00:00
|
|
|
}
|
|
|
|
|
2015-08-11 07:39:17 +00:00
|
|
|
void ElectronBrowserClient::RenderProcessHostDestroyed(
|
|
|
|
content::RenderProcessHost* host) {
|
|
|
|
int process_id = host->GetID();
|
2017-07-10 22:48:12 +00:00
|
|
|
pending_processes_.erase(process_id);
|
2019-06-20 10:10:56 +00:00
|
|
|
renderer_is_subframe_.erase(process_id);
|
2021-02-09 20:16:21 +00:00
|
|
|
host->RemoveObserver(this);
|
2017-05-16 00:41:45 +00:00
|
|
|
}
|
|
|
|
|
2017-05-26 14:51:17 +00:00
|
|
|
void ElectronBrowserClient::RenderProcessReady(
|
|
|
|
content::RenderProcessHost* host) {
|
2017-05-16 00:41:45 +00:00
|
|
|
if (delegate_) {
|
|
|
|
static_cast<api::App*>(delegate_)->RenderProcessReady(host);
|
|
|
|
}
|
2015-08-11 07:39:17 +00:00
|
|
|
}
|
|
|
|
|
2018-09-15 00:11:49 +00:00
|
|
|
void ElectronBrowserClient::RenderProcessExited(
|
|
|
|
content::RenderProcessHost* host,
|
|
|
|
const content::ChildProcessTerminationInfo& info) {
|
2021-08-19 19:07:48 +00:00
|
|
|
if (delegate_) {
|
2020-12-01 01:47:46 +00:00
|
|
|
static_cast<api::App*>(delegate_)->RenderProcessExited(host);
|
2021-08-19 19:07:48 +00:00
|
|
|
}
|
2017-05-26 15:32:08 +00:00
|
|
|
}
|
|
|
|
|
2024-08-21 20:26:06 +00:00
|
|
|
namespace {
|
|
|
|
|
2018-07-21 15:05:21 +00:00
|
|
|
void OnOpenExternal(const GURL& escaped_url, bool allowed) {
|
2019-05-03 20:53:45 +00:00
|
|
|
if (allowed) {
|
2018-07-21 15:05:21 +00:00
|
|
|
platform_util::OpenExternal(
|
2019-05-03 20:53:45 +00:00
|
|
|
escaped_url, platform_util::OpenExternalOptions(), base::DoNothing());
|
|
|
|
}
|
2018-07-21 15:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void HandleExternalProtocolInUI(
|
|
|
|
const GURL& url,
|
2022-08-26 10:31:33 +00:00
|
|
|
content::WeakDocumentPtr document_ptr,
|
2019-12-11 00:22:35 +00:00
|
|
|
content::WebContents::OnceGetter web_contents_getter,
|
2018-07-21 15:05:21 +00:00
|
|
|
bool has_user_gesture) {
|
2019-12-11 00:22:35 +00:00
|
|
|
content::WebContents* web_contents = std::move(web_contents_getter).Run();
|
2018-07-21 15:05:21 +00:00
|
|
|
if (!web_contents)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto* permission_helper =
|
|
|
|
WebContentsPermissionHelper::FromWebContents(web_contents);
|
|
|
|
if (!permission_helper)
|
|
|
|
return;
|
|
|
|
|
2022-08-26 10:31:33 +00:00
|
|
|
content::RenderFrameHost* rfh = document_ptr.AsRenderFrameHostIfValid();
|
|
|
|
if (!rfh) {
|
|
|
|
// If the render frame host is not valid it means it was a top level
|
|
|
|
// navigation and the frame has already been disposed of. In this case we
|
|
|
|
// take the current main frame and declare it responsible for the
|
|
|
|
// transition.
|
|
|
|
rfh = web_contents->GetPrimaryMainFrame();
|
|
|
|
}
|
|
|
|
|
2022-05-17 16:48:40 +00:00
|
|
|
GURL escaped_url(base::EscapeExternalHandlerValue(url.spec()));
|
2019-05-29 20:02:15 +00:00
|
|
|
auto callback = base::BindOnce(&OnOpenExternal, escaped_url);
|
2022-08-26 10:31:33 +00:00
|
|
|
permission_helper->RequestOpenExternalPermission(rfh, std::move(callback),
|
2019-05-29 20:02:15 +00:00
|
|
|
has_user_gesture, url);
|
2018-07-21 15:05:21 +00:00
|
|
|
}
|
|
|
|
|
2024-08-21 20:26:06 +00:00
|
|
|
} // namespace
|
|
|
|
|
2018-07-21 15:05:21 +00:00
|
|
|
bool ElectronBrowserClient::HandleExternalProtocol(
|
|
|
|
const GURL& url,
|
2021-06-16 22:43:51 +00:00
|
|
|
content::WebContents::Getter web_contents_getter,
|
2021-03-16 01:28:22 +00:00
|
|
|
int frame_tree_node_id,
|
2018-07-21 15:05:21 +00:00
|
|
|
content::NavigationUIData* navigation_data,
|
2022-03-25 01:39:03 +00:00
|
|
|
bool is_primary_main_frame,
|
|
|
|
bool is_in_fenced_frame_tree,
|
2021-10-21 18:51:36 +00:00
|
|
|
network::mojom::WebSandboxFlags sandbox_flags,
|
2018-07-21 15:05:21 +00:00
|
|
|
ui::PageTransition page_transition,
|
2019-01-09 20:18:07 +00:00
|
|
|
bool has_user_gesture,
|
2024-01-10 22:23:35 +00:00
|
|
|
const std::optional<url::Origin>& initiating_origin,
|
2022-02-10 02:58:52 +00:00
|
|
|
content::RenderFrameHost* initiator_document,
|
2019-10-28 22:12:35 +00:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
2022-05-17 16:48:40 +00:00
|
|
|
content::GetUIThreadTaskRunner({})->PostTask(
|
|
|
|
FROM_HERE,
|
2019-12-11 00:22:35 +00:00
|
|
|
base::BindOnce(&HandleExternalProtocolInUI, url,
|
2022-08-26 10:31:33 +00:00
|
|
|
initiator_document
|
|
|
|
? initiator_document->GetWeakDocumentPtr()
|
|
|
|
: content::WeakDocumentPtr(),
|
2019-12-11 00:22:35 +00:00
|
|
|
std::move(web_contents_getter), has_user_gesture));
|
2018-07-21 15:05:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-09-15 15:42:43 +00:00
|
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
|
|
|
ElectronBrowserClient::CreateThrottlesForNavigation(
|
|
|
|
content::NavigationHandle* handle) {
|
|
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
|
|
|
|
throttles.push_back(std::make_unique<ElectronNavigationThrottle>(handle));
|
2020-01-13 22:55:58 +00:00
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
throttles.push_back(
|
|
|
|
std::make_unique<extensions::ExtensionNavigationThrottle>(handle));
|
|
|
|
#endif
|
|
|
|
|
2022-03-25 01:39:03 +00:00
|
|
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
2024-03-05 16:47:48 +00:00
|
|
|
throttles.push_back(std::make_unique<PDFIFrameNavigationThrottle>(handle));
|
|
|
|
throttles.push_back(std::make_unique<pdf::PdfNavigationThrottle>(
|
|
|
|
handle, std::make_unique<ChromePdfStreamDelegate>()));
|
2022-03-25 01:39:03 +00:00
|
|
|
#endif
|
|
|
|
|
2018-09-15 15:42:43 +00:00
|
|
|
return throttles;
|
|
|
|
}
|
|
|
|
|
2018-10-19 18:51:43 +00:00
|
|
|
content::MediaObserver* ElectronBrowserClient::GetMediaObserver() {
|
|
|
|
return MediaCaptureDevicesDispatcher::GetInstance();
|
|
|
|
}
|
|
|
|
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
std::unique_ptr<content::DevToolsManagerDelegate>
|
|
|
|
ElectronBrowserClient::CreateDevToolsManagerDelegate() {
|
|
|
|
return std::make_unique<DevToolsManagerDelegate>();
|
2018-10-19 13:50:30 +00:00
|
|
|
}
|
|
|
|
|
2018-10-17 18:01:11 +00:00
|
|
|
NotificationPresenter* ElectronBrowserClient::GetNotificationPresenter() {
|
2024-09-20 00:02:49 +00:00
|
|
|
if (!notification_presenter_)
|
|
|
|
notification_presenter_ = NotificationPresenter::Create();
|
2018-10-17 18:01:11 +00:00
|
|
|
return notification_presenter_.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
content::PlatformNotificationService*
|
2021-10-06 02:21:00 +00:00
|
|
|
ElectronBrowserClient::GetPlatformNotificationService() {
|
2018-10-17 18:01:11 +00:00
|
|
|
if (!notification_service_) {
|
2019-09-16 22:12:00 +00:00
|
|
|
notification_service_ = std::make_unique<PlatformNotificationService>(this);
|
2018-10-17 18:01:11 +00:00
|
|
|
}
|
|
|
|
return notification_service_.get();
|
|
|
|
}
|
|
|
|
|
2018-10-23 08:45:41 +00:00
|
|
|
base::FilePath ElectronBrowserClient::GetDefaultDownloadDirectory() {
|
2021-06-30 20:54:02 +00:00
|
|
|
base::FilePath download_path;
|
|
|
|
if (base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &download_path))
|
|
|
|
return download_path;
|
|
|
|
return base::FilePath();
|
2018-10-23 08:45:41 +00:00
|
|
|
}
|
|
|
|
|
2018-11-07 14:38:41 +00:00
|
|
|
scoped_refptr<network::SharedURLLoaderFactory>
|
|
|
|
ElectronBrowserClient::GetSystemSharedURLLoaderFactory() {
|
|
|
|
if (!g_browser_process)
|
|
|
|
return nullptr;
|
|
|
|
return g_browser_process->shared_url_loader_factory();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ElectronBrowserClient::OnNetworkServiceCreated(
|
|
|
|
network::mojom::NetworkService* network_service) {
|
2019-08-02 23:56:46 +00:00
|
|
|
if (!g_browser_process)
|
2018-11-07 14:38:41 +00:00
|
|
|
return;
|
2019-03-26 01:10:48 +00:00
|
|
|
|
2018-11-07 14:38:41 +00:00
|
|
|
g_browser_process->system_network_context_manager()->OnNetworkServiceCreated(
|
|
|
|
network_service);
|
|
|
|
}
|
|
|
|
|
2019-04-24 00:31:36 +00:00
|
|
|
std::vector<base::FilePath>
|
|
|
|
ElectronBrowserClient::GetNetworkContextsParentDirectory() {
|
2022-05-09 14:26:57 +00:00
|
|
|
base::FilePath session_data;
|
|
|
|
base::PathService::Get(DIR_SESSION_DATA, &session_data);
|
|
|
|
DCHECK(!session_data.empty());
|
2019-04-24 00:31:36 +00:00
|
|
|
|
2022-05-09 14:26:57 +00:00
|
|
|
return {session_data};
|
2019-04-24 00:31:36 +00:00
|
|
|
}
|
|
|
|
|
2019-07-03 01:22:09 +00:00
|
|
|
std::string ElectronBrowserClient::GetProduct() {
|
2019-01-21 18:32:34 +00:00
|
|
|
return "Chrome/" CHROME_VERSION_STRING;
|
|
|
|
}
|
|
|
|
|
2019-07-03 01:22:09 +00:00
|
|
|
std::string ElectronBrowserClient::GetUserAgent() {
|
2019-05-01 23:34:42 +00:00
|
|
|
if (user_agent_override_.empty())
|
|
|
|
return GetApplicationUserAgent();
|
|
|
|
return user_agent_override_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ElectronBrowserClient::SetUserAgent(const std::string& user_agent) {
|
|
|
|
user_agent_override_ = user_agent;
|
2019-01-21 18:32:34 +00:00
|
|
|
}
|
|
|
|
|
2022-06-13 16:35:42 +00:00
|
|
|
blink::UserAgentMetadata ElectronBrowserClient::GetUserAgentMetadata() {
|
|
|
|
return embedder_support::GetUserAgentMetadata();
|
|
|
|
}
|
|
|
|
|
2024-02-29 09:31:13 +00:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
|
|
|
ElectronBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
|
|
|
|
const std::string& scheme,
|
|
|
|
int frame_tree_node_id) {
|
2019-04-23 21:39:21 +00:00
|
|
|
content::WebContents* web_contents =
|
|
|
|
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
|
2020-03-26 17:34:32 +00:00
|
|
|
content::BrowserContext* context = web_contents->GetBrowserContext();
|
2020-01-15 00:20:30 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2024-02-29 09:31:13 +00:00
|
|
|
if (scheme == extensions::kExtensionScheme) {
|
|
|
|
return extensions::CreateExtensionNavigationURLLoaderFactory(
|
|
|
|
context, false /* we don't support extensions::WebViewGuest */);
|
|
|
|
}
|
2020-01-15 00:20:30 +00:00
|
|
|
#endif
|
2021-04-07 01:46:23 +00:00
|
|
|
// Always allow navigating to file:// URLs.
|
2020-03-26 17:34:32 +00:00
|
|
|
auto* protocol_registry = ProtocolRegistry::FromBrowserContext(context);
|
2024-02-29 09:31:13 +00:00
|
|
|
return protocol_registry->CreateNonNetworkNavigationURLLoaderFactory(scheme);
|
2019-04-23 21:39:21 +00:00
|
|
|
}
|
|
|
|
|
2020-07-28 01:48:37 +00:00
|
|
|
void ElectronBrowserClient::
|
|
|
|
RegisterNonNetworkWorkerMainResourceURLLoaderFactories(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
NonNetworkURLLoaderFactoryMap* factories) {
|
|
|
|
auto* protocol_registry =
|
|
|
|
ProtocolRegistry::FromBrowserContext(browser_context);
|
2021-04-07 01:46:23 +00:00
|
|
|
// Workers are not allowed to request file:// URLs, there is no particular
|
|
|
|
// reason for it, and we could consider supporting it in future.
|
|
|
|
protocol_registry->RegisterURLLoaderFactories(factories,
|
|
|
|
false /* allow_file_access */);
|
2020-07-28 01:48:37 +00:00
|
|
|
}
|
|
|
|
|
2020-02-13 00:39:12 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
// The FileURLLoaderFactory provided to the extension background pages.
|
|
|
|
// Checks with the ChildProcessSecurityPolicy to validate the file access.
|
2021-03-04 17:27:05 +00:00
|
|
|
class FileURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
|
2020-02-13 00:39:12 +00:00
|
|
|
public:
|
2020-09-21 08:00:36 +00:00
|
|
|
static mojo::PendingRemote<network::mojom::URLLoaderFactory> Create(
|
|
|
|
int child_id) {
|
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote;
|
|
|
|
|
|
|
|
// The FileURLLoaderFactory will delete itself when there are no more
|
2021-06-07 01:18:17 +00:00
|
|
|
// receivers - see the SelfDeletingURLLoaderFactory::OnDisconnect method.
|
2020-09-21 08:00:36 +00:00
|
|
|
new FileURLLoaderFactory(child_id,
|
|
|
|
pending_remote.InitWithNewPipeAndPassReceiver());
|
|
|
|
|
|
|
|
return pending_remote;
|
|
|
|
}
|
2020-02-13 00:39:12 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
FileURLLoaderFactory(const FileURLLoaderFactory&) = delete;
|
|
|
|
FileURLLoaderFactory& operator=(const FileURLLoaderFactory&) = delete;
|
|
|
|
|
2020-02-13 00:39:12 +00:00
|
|
|
private:
|
2020-09-21 08:00:36 +00:00
|
|
|
explicit FileURLLoaderFactory(
|
|
|
|
int child_id,
|
|
|
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver)
|
2021-03-04 17:27:05 +00:00
|
|
|
: network::SelfDeletingURLLoaderFactory(std::move(factory_receiver)),
|
2020-09-21 08:00:36 +00:00
|
|
|
child_id_(child_id) {}
|
|
|
|
~FileURLLoaderFactory() override = default;
|
|
|
|
|
2020-02-13 00:39:12 +00:00
|
|
|
// network::mojom::URLLoaderFactory:
|
|
|
|
void CreateLoaderAndStart(
|
|
|
|
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
|
|
|
int32_t request_id,
|
|
|
|
uint32_t options,
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
|
|
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation)
|
|
|
|
override {
|
|
|
|
if (!content::ChildProcessSecurityPolicy::GetInstance()->CanRequestURL(
|
|
|
|
child_id_, request.url)) {
|
|
|
|
mojo::Remote<network::mojom::URLLoaderClient>(std::move(client))
|
|
|
|
->OnComplete(
|
|
|
|
network::URLLoaderCompletionStatus(net::ERR_ACCESS_DENIED));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
content::CreateFileURLLoaderBypassingSecurityChecks(
|
|
|
|
request, std::move(loader), std::move(client),
|
|
|
|
/*observer=*/nullptr,
|
|
|
|
/* allow_directory_listing */ true);
|
|
|
|
}
|
|
|
|
|
|
|
|
int child_id_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
|
2019-05-07 02:33:05 +00:00
|
|
|
void ElectronBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
|
|
|
int render_process_id,
|
|
|
|
int render_frame_id,
|
2024-01-10 22:23:35 +00:00
|
|
|
const std::optional<url::Origin>& request_initiator_origin,
|
2019-05-07 02:33:05 +00:00
|
|
|
NonNetworkURLLoaderFactoryMap* factories) {
|
2021-03-23 15:16:53 +00:00
|
|
|
auto* render_process_host =
|
|
|
|
content::RenderProcessHost::FromID(render_process_id);
|
|
|
|
DCHECK(render_process_host);
|
|
|
|
if (!render_process_host || !render_process_host->GetBrowserContext())
|
|
|
|
return;
|
|
|
|
|
2021-04-07 01:46:23 +00:00
|
|
|
content::RenderFrameHost* frame_host =
|
|
|
|
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
|
|
|
|
content::WebContents* web_contents =
|
|
|
|
content::WebContents::FromRenderFrameHost(frame_host);
|
|
|
|
|
|
|
|
// Allow accessing file:// subresources from non-file protocols if web
|
|
|
|
// security is disabled.
|
|
|
|
bool allow_file_access = false;
|
|
|
|
if (web_contents) {
|
|
|
|
const auto& web_preferences = web_contents->GetOrCreateWebPreferences();
|
|
|
|
if (!web_preferences.web_security_enabled)
|
|
|
|
allow_file_access = true;
|
|
|
|
}
|
|
|
|
|
2021-03-23 15:16:53 +00:00
|
|
|
ProtocolRegistry::FromBrowserContext(render_process_host->GetBrowserContext())
|
2021-04-07 01:46:23 +00:00
|
|
|
->RegisterURLLoaderFactories(factories, allow_file_access);
|
2020-02-13 00:39:12 +00:00
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
auto factory = extensions::CreateExtensionURLLoaderFactory(render_process_id,
|
|
|
|
render_frame_id);
|
|
|
|
if (factory)
|
2020-10-16 01:30:41 +00:00
|
|
|
factories->emplace(extensions::kExtensionScheme, std::move(factory));
|
2020-02-13 00:39:12 +00:00
|
|
|
|
|
|
|
if (!web_contents)
|
|
|
|
return;
|
|
|
|
|
|
|
|
extensions::ElectronExtensionWebContentsObserver* web_observer =
|
|
|
|
extensions::ElectronExtensionWebContentsObserver::FromWebContents(
|
|
|
|
web_contents);
|
|
|
|
|
|
|
|
// There is nothing to do if no ElectronExtensionWebContentsObserver is
|
|
|
|
// attached to the |web_contents|.
|
|
|
|
if (!web_observer)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const extensions::Extension* extension =
|
|
|
|
web_observer->GetExtensionFromFrame(frame_host, false);
|
|
|
|
if (!extension)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Support for chrome:// scheme if appropriate.
|
|
|
|
if (extension->is_extension() &&
|
|
|
|
extensions::Manifest::IsComponentLocation(extension->location())) {
|
|
|
|
// Components of chrome that are implemented as extensions or platform apps
|
|
|
|
// are allowed to use chrome://resources/ and chrome://theme/ URLs.
|
2020-09-21 08:00:36 +00:00
|
|
|
factories->emplace(content::kChromeUIScheme,
|
|
|
|
content::CreateWebUIURLLoaderFactory(
|
|
|
|
frame_host, content::kChromeUIScheme,
|
|
|
|
{content::kChromeUIResourcesHost}));
|
2020-02-13 00:39:12 +00:00
|
|
|
}
|
|
|
|
|
2021-05-14 12:06:55 +00:00
|
|
|
// Extensions with the necessary permissions get access to file:// URLs that
|
|
|
|
// gets approval from ChildProcessSecurityPolicy. Keep this logic in sync with
|
|
|
|
// ExtensionWebContentsObserver::RenderFrameCreated.
|
|
|
|
extensions::Manifest::Type type = extension->GetType();
|
|
|
|
if (type == extensions::Manifest::TYPE_EXTENSION &&
|
|
|
|
AllowFileAccess(extension->id(), web_contents->GetBrowserContext())) {
|
2020-09-21 08:00:36 +00:00
|
|
|
factories->emplace(url::kFileScheme,
|
|
|
|
FileURLLoaderFactory::Create(render_process_id));
|
2020-02-13 00:39:12 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
void ElectronBrowserClient::
|
|
|
|
RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
NonNetworkURLLoaderFactoryMap* factories) {
|
|
|
|
DCHECK(browser_context);
|
|
|
|
DCHECK(factories);
|
|
|
|
|
2022-05-23 07:42:37 +00:00
|
|
|
auto* protocol_registry =
|
|
|
|
ProtocolRegistry::FromBrowserContext(browser_context);
|
|
|
|
protocol_registry->RegisterURLLoaderFactories(factories,
|
|
|
|
false /* allow_file_access */);
|
|
|
|
|
2023-10-04 08:40:01 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2022-02-10 02:58:52 +00:00
|
|
|
factories->emplace(
|
|
|
|
extensions::kExtensionScheme,
|
|
|
|
extensions::CreateExtensionServiceWorkerScriptURLLoaderFactory(
|
|
|
|
browser_context));
|
2023-10-04 08:40:01 +00:00
|
|
|
#endif // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2022-02-10 02:58:52 +00:00
|
|
|
}
|
|
|
|
|
2020-02-13 00:39:12 +00:00
|
|
|
bool ElectronBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
|
2024-07-29 13:37:35 +00:00
|
|
|
std::string_view scheme,
|
2020-02-13 00:39:12 +00:00
|
|
|
bool is_embedded_origin_secure) {
|
|
|
|
if (is_embedded_origin_secure && scheme == content::kChromeUIScheme)
|
|
|
|
return true;
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
return scheme == extensions::kExtensionScheme;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2019-05-07 02:33:05 +00:00
|
|
|
}
|
|
|
|
|
2020-02-11 05:56:09 +00:00
|
|
|
bool ElectronBrowserClient::WillInterceptWebSocket(
|
|
|
|
content::RenderFrameHost* frame) {
|
|
|
|
if (!frame)
|
|
|
|
return false;
|
|
|
|
|
2020-06-22 16:35:24 +00:00
|
|
|
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
2020-03-11 01:16:58 +00:00
|
|
|
v8::HandleScope scope(isolate);
|
2020-02-11 05:56:09 +00:00
|
|
|
auto* browser_context = frame->GetProcess()->GetBrowserContext();
|
|
|
|
auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context);
|
|
|
|
|
|
|
|
// NOTE: Some unit test environments do not initialize
|
|
|
|
// BrowserContextKeyedAPI factories for e.g. WebRequest.
|
|
|
|
if (!web_request.get())
|
|
|
|
return false;
|
|
|
|
|
2020-12-18 23:11:43 +00:00
|
|
|
bool has_listener = web_request->HasListener();
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
const auto* web_request_api =
|
|
|
|
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
|
|
|
|
browser_context);
|
|
|
|
|
|
|
|
if (web_request_api)
|
|
|
|
has_listener |= web_request_api->MayHaveProxies();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return has_listener;
|
2020-02-11 05:56:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ElectronBrowserClient::CreateWebSocket(
|
|
|
|
content::RenderFrameHost* frame,
|
|
|
|
WebSocketFactory factory,
|
|
|
|
const GURL& url,
|
|
|
|
const net::SiteForCookies& site_for_cookies,
|
2024-01-10 22:23:35 +00:00
|
|
|
const std::optional<std::string>& user_agent,
|
2020-02-11 05:56:09 +00:00
|
|
|
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
|
|
|
handshake_client) {
|
2020-06-22 16:35:24 +00:00
|
|
|
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
2020-03-11 01:16:58 +00:00
|
|
|
v8::HandleScope scope(isolate);
|
2020-02-11 05:56:09 +00:00
|
|
|
auto* browser_context = frame->GetProcess()->GetBrowserContext();
|
2020-12-18 23:11:43 +00:00
|
|
|
|
2020-02-11 05:56:09 +00:00
|
|
|
auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context);
|
|
|
|
DCHECK(web_request.get());
|
2020-12-18 23:11:43 +00:00
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
if (!web_request->HasListener()) {
|
|
|
|
auto* web_request_api = extensions::BrowserContextKeyedAPIFactory<
|
|
|
|
extensions::WebRequestAPI>::Get(browser_context);
|
|
|
|
|
|
|
|
if (web_request_api && web_request_api->MayHaveProxies()) {
|
|
|
|
web_request_api->ProxyWebSocket(frame, std::move(factory), url,
|
2021-08-24 00:52:17 +00:00
|
|
|
site_for_cookies, user_agent,
|
|
|
|
std::move(handshake_client));
|
2020-12-18 23:11:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-02-11 05:56:09 +00:00
|
|
|
ProxyingWebSocket::StartProxying(
|
2021-08-24 00:52:17 +00:00
|
|
|
web_request.get(), std::move(factory), url, site_for_cookies, user_agent,
|
2020-02-11 05:56:09 +00:00
|
|
|
std::move(handshake_client), true, frame->GetProcess()->GetID(),
|
|
|
|
frame->GetRoutingID(), frame->GetLastCommittedOrigin(), browser_context,
|
|
|
|
&next_id_);
|
|
|
|
}
|
|
|
|
|
2024-01-31 23:04:13 +00:00
|
|
|
void ElectronBrowserClient::WillCreateURLLoaderFactory(
|
2019-05-22 01:43:37 +00:00
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
content::RenderFrameHost* frame_host,
|
|
|
|
int render_process_id,
|
2019-08-24 01:14:23 +00:00
|
|
|
URLLoaderFactoryType type,
|
2019-05-22 01:43:37 +00:00
|
|
|
const url::Origin& request_initiator,
|
2024-05-10 15:21:10 +00:00
|
|
|
const net::IsolationInfo& isolation_info,
|
2024-01-10 22:23:35 +00:00
|
|
|
std::optional<int64_t> navigation_id,
|
2020-10-28 00:33:04 +00:00
|
|
|
ukm::SourceIdObj ukm_source_id,
|
2024-01-31 23:04:13 +00:00
|
|
|
network::URLLoaderFactoryBuilder& factory_builder,
|
2019-09-18 19:58:00 +00:00
|
|
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
|
|
|
header_client,
|
2019-12-11 00:22:35 +00:00
|
|
|
bool* bypass_redirect_checks,
|
2020-01-17 18:41:52 +00:00
|
|
|
bool* disable_secure_dns,
|
2023-06-09 23:08:36 +00:00
|
|
|
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
|
|
|
|
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
|
2020-06-22 16:35:24 +00:00
|
|
|
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
2020-03-11 01:16:58 +00:00
|
|
|
v8::HandleScope scope(isolate);
|
2019-10-24 00:51:06 +00:00
|
|
|
auto web_request = api::WebRequest::FromOrCreate(isolate, browser_context);
|
2019-08-13 05:47:35 +00:00
|
|
|
DCHECK(web_request.get());
|
2019-05-22 01:43:37 +00:00
|
|
|
|
2020-12-18 23:11:43 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
if (!web_request->HasListener()) {
|
|
|
|
auto* web_request_api = extensions::BrowserContextKeyedAPIFactory<
|
|
|
|
extensions::WebRequestAPI>::Get(browser_context);
|
|
|
|
|
|
|
|
DCHECK(web_request_api);
|
2024-01-31 23:04:13 +00:00
|
|
|
bool used_proxy_for_web_request =
|
2020-12-18 23:11:43 +00:00
|
|
|
web_request_api->MaybeProxyURLLoaderFactory(
|
|
|
|
browser_context, frame_host, render_process_id, type, navigation_id,
|
2024-01-31 23:04:13 +00:00
|
|
|
ukm_source_id, factory_builder, header_client,
|
2023-06-09 23:08:36 +00:00
|
|
|
navigation_response_task_runner);
|
2020-12-18 23:11:43 +00:00
|
|
|
|
|
|
|
if (bypass_redirect_checks)
|
2024-01-31 23:04:13 +00:00
|
|
|
*bypass_redirect_checks = used_proxy_for_web_request;
|
|
|
|
if (used_proxy_for_web_request)
|
|
|
|
return;
|
2020-12-18 23:11:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2024-01-31 23:04:13 +00:00
|
|
|
auto [proxied_receiver, target_factory_remote] = factory_builder.Append();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2020-01-22 01:31:10 +00:00
|
|
|
// Required by WebRequestInfoInitParams.
|
|
|
|
//
|
|
|
|
// Note that in Electron we allow webRequest to capture requests sent from
|
|
|
|
// browser process, so creation of |navigation_ui_data| is different from
|
|
|
|
// Chromium which only does for renderer-initialized navigations.
|
|
|
|
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data;
|
|
|
|
if (navigation_id.has_value()) {
|
|
|
|
navigation_ui_data =
|
|
|
|
std::make_unique<extensions::ExtensionNavigationUIData>();
|
|
|
|
}
|
|
|
|
|
2019-09-18 19:58:00 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
|
|
|
header_client_receiver;
|
2019-07-22 22:01:45 +00:00
|
|
|
if (header_client)
|
2019-09-18 19:58:00 +00:00
|
|
|
header_client_receiver = header_client->InitWithNewPipeAndPassReceiver();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2020-03-26 17:34:32 +00:00
|
|
|
auto* protocol_registry =
|
|
|
|
ProtocolRegistry::FromBrowserContext(browser_context);
|
2019-12-11 00:22:35 +00:00
|
|
|
new ProxyingURLLoaderFactory(
|
2020-03-26 17:34:32 +00:00
|
|
|
web_request.get(), protocol_registry->intercept_handlers(),
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
render_process_id,
|
2022-03-30 18:08:58 +00:00
|
|
|
frame_host ? frame_host->GetRoutingID() : MSG_ROUTING_NONE, &next_id_,
|
|
|
|
std::move(navigation_ui_data), std::move(navigation_id),
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
std::move(proxied_receiver), std::move(target_factory_remote),
|
|
|
|
std::move(header_client_receiver), type);
|
2019-05-22 01:43:37 +00:00
|
|
|
}
|
|
|
|
|
2022-03-25 01:39:03 +00:00
|
|
|
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
|
|
|
|
ElectronBrowserClient::WillCreateURLLoaderRequestInterceptors(
|
|
|
|
content::NavigationUIData* navigation_ui_data,
|
2023-06-13 18:45:48 +00:00
|
|
|
int frame_tree_node_id,
|
|
|
|
int64_t navigation_id,
|
chore: bump chromium to 128.0.6611.0 (main) (#42779)
* chore: bump chromium in DEPS to 128.0.6577.0
* chore: bump chromium in DEPS to 128.0.6579.0
* 5675706: Reland "Reland "Reland "Reland "Add toolchains without PartitionAlloc-Everywhere for dump_syms et al""""
https://chromium-review.googlesource.com/c/chromium/src/+/5675706
* 5668597: [PDF Ink Signatures] Prompt download menu on save when there are edits
https://chromium-review.googlesource.com/c/chromium/src/+/5668597
* 5677014: Reland "Pull data_sharing_sdk from CIPD"
https://chromium-review.googlesource.com/c/chromium/src/+/5677014
* chore: fixup patch indices
* chore: bump chromium in DEPS to 128.0.6581.0
* chore: bump chromium in DEPS to 128.0.6583.0
* update patches
* 5455480: [Extensions] Allow service worker requests to continue without a cert
https://chromium-review.googlesource.com/c/chromium/src/+/5455480
* try to get some debugging output from script/push-patch.js
* chore: bump chromium in DEPS to 128.0.6585.0
* chore: bump chromium in DEPS to 128.0.6587.0
* update patches
* chore: bump chromium in DEPS to 128.0.6589.0
* more patch work
* maybe over here?
* chore: update patches
* 5673207: [HTTPS Upgrades] Disable in captive portal login webview
https://chromium-review.googlesource.com/c/chromium/src/+/5673207
* 5636785: Extensions: WAR: manifest.json's use_dynamic_url requires a dynamic url
https://chromium-review.googlesource.com/c/chromium/src/+/5636785
* chore: bump chromium in DEPS to 128.0.6591.0
* 5665458: Trigger WN2 page when feature is enabled
https://chromium-review.googlesource.com/c/chromium/src/+/5665458
* update patches
* chore: bump chromium in DEPS to 128.0.6593.0
* chore: bump chromium in DEPS to 128.0.6595.0
* chore: bump chromium in DEPS to 128.0.6597.0
* (patch update) 5694586: [compile hints] Remove the usage of v8::Isolate::SetJavaScriptCompileHintsMagicEnabledCallback API
https://chromium-review.googlesource.com/c/chromium/src/+/5694586
* update patches
* 5691287: Reland "Change blink::WebKeyboardEvent to use std::array in is members"
https://chromium-review.googlesource.com/c/chromium/src/+/5691287
The code changed here is modeled after code in `content/renderer/pepper/event_conversion.cc` that was also modified in this CL, so I took the same approach.
* 5529018: Cleanup EnableWebHidOnExtensionServiceWorker flag
https://chromium-review.googlesource.com/c/chromium/src/+/5529018
* 5526324: [Code Health] Add deprecation comment for base::SupportsWeakPtr.
https://chromium-review.googlesource.com/c/chromium/src/+/5526324
Note that this CL actually does make `SupportsWeakPtr` strictly restricted to existing implementations, no new ones. We could add a patch to add ourselves to this list, but it looks like we'll have to refactor this anyways in the near future. Since the refactor seems straightforward, let's try that first.
* chore: bump chromium in DEPS to 128.0.6598.0
* chore: update patches
* 5704737: Rename ExclusiveAccessContext::GetActiveWebContents to avoid conflict
https://chromium-review.googlesource.com/c/chromium/src/+/5704737
* chore: bump chromium in DEPS to 128.0.6601.0
* chore: update patches
* Add `base::StringPiece` header includes
Chromium is working on replacing `base::StringPiece` with `std::string_view`. (See the Chromium Bug below.) They're currently running mass codemods (across many multiple changes) to replace uses of `StringPiece` with `string_view`, including removing the header include for `StringPiece` in those files. This cascades down to our files that were implicitly depending on those includes through some other include.
They're on track to eventually deprecate and remove `StringPiece` so our code should be converted, but that can be done as an upgrade follow-up task. For now, adding the header back to files that need it should suffice for minimal upgrade changes.
Chromium Bug: https://issues.chromium.org/issues/40506050
* 5702737: GlobalRequestID: Avoid unwanted inlining and narrowing int conversions
https://chromium-review.googlesource.com/c/chromium/src/+/5702737
contender for smallest commit 2024
* 5706534: Rename GlobalFeatures to GlobalDesktopFeatures.
https://chromium-review.googlesource.com/c/chromium/src/+/5706534
* 5691321: ui: remove params variants of SelectFile listener functions
https://chromium-review.googlesource.com/c/chromium/src/+/5691321
* 5714949: [Extensions] Display re-enable dialog for MV2 disabled stage
https://chromium-review.googlesource.com/c/chromium/src/+/5714949
* chore: update libc++ filenames
* patch: disable scope reuse & associated dchecks in v8 (hopefully temp, upgrade follow-up)
* fixup! Add `base::StringPiece` header includes
* update MAS patch
5710330: Add crash keys to debug NativeWidgetMacNSWindowBorderlessFrame exception
https://chromium-review.googlesource.com/c/chromium/src/+/5710330
* chore: bump chromium in DEPS to 128.0.6603.0
* chore: update patches
* 5713258: Reland "Preparation for decoupling creation/initialization of context"
https://chromium-review.googlesource.com/c/chromium/src/+/5713258
When destroying a context, it must already be shutdown, and this change enforces it with a new CHECK.
We were overriding `BrowserContextKeyedServiceFactory::BrowserContextShutdown` with an empty implementation, which differed from the default implementation that notifies the `KeyedServiceFactory` that the context has shutdown. Since we were missing this notification, the CHECK would later trip when the service was being destoryed because it was not registered as shutdown when it was shutdown.
* chore: bump chromium in DEPS to 128.0.6605.2
* chore: update patches
* refactor: linux open/save dialog patch
Our existing implementation was relying on an opaque `void* params` parameter that was passed through `ui::SelectFileDialog`.
Recently, that parameter has been getting removed:
- 5691321: ui: remove params variants of SelectFile listener functions | https://chromium-review.googlesource.com/c/chromium/src/+/5691321
- 5709097: ui: remove SelectFileDialog impl params | https://chromium-review.googlesource.com/c/chromium/src/+/5709097
- https://issues.chromium.org/issues/340178601 "reconsider SelectFileDialog"
This restructures the patch to work with mostly the same mechanics, but directly on the `ui::SelectFileDialog` object. This nets us some wins in terms of a smaller patch.
* 5713262: DevTools UI binding AIDA client event returns response
https://chromium-review.googlesource.com/c/chromium/src/+/5713262
* fixup! refactor: linux open/save dialog patch
* chore: bump chromium in DEPS to 128.0.6606.0
* chore: update patches
* fixup! refactor: linux open/save dialog patch
* chore: bump chromium in DEPS to 128.0.6607.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5722937
* fix: pwd error in electron-test, nan-test
fix: unshallow depot_tools before 3-way apply
* chore: e patches all
* fixup! fix: pwd error in electron-test, nan-test
* chore: bump chromium in DEPS to 128.0.6609.0
* chore: bump chromium in DEPS to 128.0.6611.0
* chore: update patches
* chore: update libcxx filenames
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Alice Zhao <alice@makenotion.com>
2024-07-23 15:59:44 +00:00
|
|
|
bool force_no_https_upgrade,
|
2023-06-13 18:45:48 +00:00
|
|
|
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
|
2022-03-25 01:39:03 +00:00
|
|
|
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
|
|
|
|
interceptors;
|
|
|
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
|
|
|
{
|
|
|
|
std::unique_ptr<content::URLLoaderRequestInterceptor> pdf_interceptor =
|
|
|
|
pdf::PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor(
|
|
|
|
frame_tree_node_id, std::make_unique<ChromePdfStreamDelegate>());
|
|
|
|
if (pdf_interceptor)
|
|
|
|
interceptors.push_back(std::move(pdf_interceptor));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return interceptors;
|
|
|
|
}
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
void ElectronBrowserClient::OverrideURLLoaderFactoryParams(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const url::Origin& origin,
|
|
|
|
bool is_for_isolated_world,
|
|
|
|
network::mojom::URLLoaderFactoryParams* factory_params) {
|
2021-04-23 19:57:40 +00:00
|
|
|
if (factory_params->top_frame_id) {
|
|
|
|
// Bypass CORB and CORS when web security is disabled.
|
|
|
|
auto* rfh = content::RenderFrameHost::FromFrameToken(
|
2023-11-14 21:21:32 +00:00
|
|
|
content::GlobalRenderFrameHostToken(
|
|
|
|
factory_params->process_id,
|
|
|
|
blink::LocalFrameToken(factory_params->top_frame_id.value())));
|
2021-04-23 19:57:40 +00:00
|
|
|
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
|
|
|
auto* prefs = WebContentsPreferences::From(web_contents);
|
2021-07-26 16:04:09 +00:00
|
|
|
if (prefs && !prefs->IsWebSecurityEnabled()) {
|
2024-02-21 20:27:05 +00:00
|
|
|
factory_params->is_orb_enabled = false;
|
2021-04-23 19:57:40 +00:00
|
|
|
factory_params->disable_web_security = true;
|
|
|
|
}
|
2019-08-02 23:56:46 +00:00
|
|
|
}
|
2023-10-04 08:40:01 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2020-08-03 23:56:18 +00:00
|
|
|
extensions::URLLoaderFactoryManager::OverrideURLLoaderFactoryParams(
|
|
|
|
browser_context, origin, is_for_isolated_world, factory_params);
|
2023-10-04 08:40:01 +00:00
|
|
|
#endif
|
2019-08-02 23:56:46 +00:00
|
|
|
}
|
|
|
|
|
2023-11-15 14:30:47 +00:00
|
|
|
void ElectronBrowserClient::RegisterAssociatedInterfaceBindersForServiceWorker(
|
|
|
|
const content::ServiceWorkerVersionBaseInfo& service_worker_version_info,
|
|
|
|
blink::AssociatedInterfaceRegistry& associated_registry) {
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
associated_registry.AddInterface<extensions::mojom::RendererHost>(
|
|
|
|
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
|
|
|
service_worker_version_info.process_id));
|
|
|
|
associated_registry.AddInterface<extensions::mojom::ServiceWorkerHost>(
|
|
|
|
base::BindRepeating(&extensions::ServiceWorkerHost::BindReceiver,
|
|
|
|
service_worker_version_info.process_id));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
void ElectronBrowserClient::
|
|
|
|
RegisterAssociatedInterfaceBindersForRenderFrameHost(
|
|
|
|
content::RenderFrameHost&
|
|
|
|
render_frame_host, // NOLINT(runtime/references)
|
|
|
|
blink::AssociatedInterfaceRegistry&
|
|
|
|
associated_registry) { // NOLINT(runtime/references)
|
2022-03-19 02:50:05 +00:00
|
|
|
auto* contents =
|
|
|
|
content::WebContents::FromRenderFrameHost(&render_frame_host);
|
|
|
|
if (contents) {
|
|
|
|
auto* prefs = WebContentsPreferences::From(contents);
|
|
|
|
if (render_frame_host.GetFrameTreeNodeId() ==
|
2022-06-27 20:50:08 +00:00
|
|
|
contents->GetPrimaryMainFrame()->GetFrameTreeNodeId() ||
|
2022-03-19 02:50:05 +00:00
|
|
|
(prefs && prefs->AllowsNodeIntegrationInSubFrames())) {
|
2022-09-07 07:46:37 +00:00
|
|
|
associated_registry.AddInterface<mojom::ElectronApiIPC>(
|
|
|
|
base::BindRepeating(
|
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
|
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronApiIPC>
|
|
|
|
receiver) {
|
|
|
|
ElectronApiIPCHandlerImpl::Create(render_frame_host,
|
|
|
|
std::move(receiver));
|
|
|
|
},
|
|
|
|
&render_frame_host));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
associated_registry.AddInterface<mojom::ElectronWebContentsUtility>(
|
|
|
|
base::BindRepeating(
|
2022-03-19 02:50:05 +00:00
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
2022-09-07 07:46:37 +00:00
|
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronWebContentsUtility>
|
2022-03-19 02:50:05 +00:00
|
|
|
receiver) {
|
2022-09-07 07:46:37 +00:00
|
|
|
ElectronWebContentsUtilityHandlerImpl::Create(render_frame_host,
|
|
|
|
std::move(receiver));
|
2022-03-19 02:50:05 +00:00
|
|
|
},
|
|
|
|
&render_frame_host));
|
|
|
|
|
2022-09-07 07:46:37 +00:00
|
|
|
associated_registry.AddInterface<mojom::ElectronAutofillDriver>(
|
|
|
|
base::BindRepeating(
|
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
|
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver>
|
|
|
|
receiver) {
|
|
|
|
AutofillDriverFactory::BindAutofillDriver(std::move(receiver),
|
|
|
|
render_frame_host);
|
|
|
|
},
|
|
|
|
&render_frame_host));
|
2024-08-12 08:28:33 +00:00
|
|
|
associated_registry.AddInterface<mojom::ElectronPluginInfoHost>(
|
|
|
|
base::BindRepeating(
|
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
|
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronPluginInfoHost>
|
|
|
|
receiver) {
|
|
|
|
mojo::MakeSelfOwnedAssociatedReceiver(
|
|
|
|
std::make_unique<ElectronPluginInfoHostImpl>(),
|
|
|
|
std::move(receiver));
|
|
|
|
},
|
|
|
|
&render_frame_host));
|
2021-08-24 00:52:17 +00:00
|
|
|
#if BUILDFLAG(ENABLE_PRINTING)
|
2022-09-07 07:46:37 +00:00
|
|
|
associated_registry.AddInterface<printing::mojom::PrintManagerHost>(
|
|
|
|
base::BindRepeating(
|
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
|
|
|
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>
|
|
|
|
receiver) {
|
|
|
|
PrintViewManagerElectron::BindPrintManagerHost(std::move(receiver),
|
|
|
|
render_frame_host);
|
|
|
|
},
|
|
|
|
&render_frame_host));
|
2021-08-24 00:52:17 +00:00
|
|
|
#endif
|
2023-10-04 08:40:01 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2023-11-15 14:30:47 +00:00
|
|
|
int render_process_id = render_frame_host.GetProcess()->GetID();
|
|
|
|
associated_registry.AddInterface<extensions::mojom::EventRouter>(
|
|
|
|
base::BindRepeating(&extensions::EventRouter::BindForRenderer,
|
|
|
|
render_process_id));
|
|
|
|
associated_registry.AddInterface<extensions::mojom::RendererHost>(
|
|
|
|
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
|
|
|
render_process_id));
|
2022-09-07 07:46:37 +00:00
|
|
|
associated_registry.AddInterface<extensions::mojom::LocalFrameHost>(
|
|
|
|
base::BindRepeating(
|
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
|
|
|
mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>
|
|
|
|
receiver) {
|
|
|
|
extensions::ExtensionWebContentsObserver::BindLocalFrameHost(
|
|
|
|
std::move(receiver), render_frame_host);
|
|
|
|
},
|
|
|
|
&render_frame_host));
|
2023-11-03 19:37:55 +00:00
|
|
|
associated_registry.AddInterface<guest_view::mojom::GuestViewHost>(
|
|
|
|
base::BindRepeating(&extensions::ExtensionsGuestView::CreateForComponents,
|
|
|
|
render_frame_host.GetGlobalId()));
|
|
|
|
associated_registry.AddInterface<extensions::mojom::GuestView>(
|
|
|
|
base::BindRepeating(&extensions::ExtensionsGuestView::CreateForExtensions,
|
|
|
|
render_frame_host.GetGlobalId()));
|
2021-08-24 00:52:17 +00:00
|
|
|
#endif
|
|
|
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
2024-04-15 22:10:32 +00:00
|
|
|
associated_registry.AddInterface<pdf::mojom::PdfHost>(base::BindRepeating(
|
2022-02-10 02:58:52 +00:00
|
|
|
[](content::RenderFrameHost* render_frame_host,
|
2024-04-15 22:10:32 +00:00
|
|
|
mojo::PendingAssociatedReceiver<pdf::mojom::PdfHost> receiver) {
|
|
|
|
pdf::PDFDocumentHelper::BindPdfHost(
|
chore: bump chromium to 118.0.5975.0 (main) (#39531)
* chore: bump chromium in DEPS to 118.0.5951.0
* chore: update printing.patch
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4727894
No logic changes, but patch needed to be manually re-applied due to upstream code shear
* chore: update port_autofill_colors_to_the_color_pipeline.patch
No manual changes; patch applied with fuzz
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5953.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5955.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5957.0
* chore: update patches
* chore: include path of native_web_keyboard_event.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
* chore: remove reference to eextensions/browser/notification-types.h
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4771627
* chore: update references to renamed upstream field NativeWebKeyboardEvent.skip_if_unhandled (formerly known as skip_in_browser
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4758689
Need a second pair of eyes on this commit. In particular the reference in content_converter.cc, skipInBrowser, seems to not be set or documented anywhere? Is this unused/vestigal code?
* chore: sync signature of ElectronExtensionsBrowserClient::IsValidContext() to upstream change
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4784198
* chore: add auto_pip_setting_helper.[cc,h] to chromium_src build
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4688277
Exiting upstream code used by chromium_src now depends on this new upstream class
* chore: bump chromium in DEPS to 118.0.5959.0
* chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
Xref: add_maximized_parameter_to_linuxui_getwindowframeprovider.patch
manually adjust patch to minor upstream chagnes
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5961.0
* chore: bump chromium in DEPS to 118.0.5963.0
* chore: update patches
* 4780994: Rename various base files to "apple" since iOS uses them too
https://chromium-review.googlesource.com/c/chromium/src/+/4780994
* Many files moved from `mac` -> `apple`
This commit follows a handful of CLs that simply rename files/symbols to change `mac`
to `apple`
to signify their use across both macOS and iOS:
- 4784010: Move scoped_nsautorelease_pool to base/apple, leave a forwarding header
- 4790744: Move foundation_util to base/apple, leave a forwarding header
- 4790741: Move scoped_cftypreref to base/apple, leave a forwarding header
- 4787627: Move and rename macOS+iOS base/ files in PA to "apple"
- 4780399: Move OSStatus logging to base/apple
- 4787387: Remove forwarding headers
- 4781113: Rename message_pump_mac to "apple" because iOS uses it too
* fixup minor patch update error
A function param got dropped from this patch somewhere earlier
* chore: bump chromium in DEPS to 118.0.5965.2
* chore: update patches
* 4799213: Move ScopedTypeRef and ScopedCFTypeRef into base::apple::
https://chromium-review.googlesource.com/c/chromium/src/+/4799213
* Fix removed include to BrowserContext
In crrev.com/c/4767962 an include to BrowserContext was removed,
which was necessary for compilation. This broke only for us because
"chrome/browser/profiles/profile.h" includes that class, but we remove
all references to profiles.
* chore: bump chromium in DEPS to 118.0.5967.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5969.0
* chore: update patches
* chore: bump chromium in DEPS to 118.0.5971.0
* chore: bump chromium in DEPS to 118.0.5973.0
* chore: update patches
* 4772121: [OOPIF PDF] Replace PDFWebContentsHelper with PDFDocumentHelper
https://chromium-review.googlesource.com/c/chromium/src/+/4772121
* 4811164: [Extensions] Do some cleanup in ChromeManagementAPIDelegate.
https://chromium-review.googlesource.com/c/chromium/src/+/4811164
* 4809488: Remove duplicate dnd functionality between Web and Renderer prefs
https://chromium-review.googlesource.com/c/chromium/src/+/4809488
Given that this is no longer an option of web preferences, we should
consider deprecating this option and then removing it.
* chore: bump chromium in DEPS to 118.0.5975.0
* chore: update patches
* fixup! chore: add auto_pip_settings_helper.{cc|h} to chromium_src build
* Reland "[windows] Remove RegKey::DeleteEmptyKey"
Refs https://chromium-review.googlesource.com/c/chromium/src/+/4813255
* Ensure StrCat means StrCat
Refs https://chromium-review.googlesource.com/c/chromium/src/+/1117180
* fixup! Remove RegKey::DeleteEmptyKey
* Consistently reject large p and large q in DH
Refs https://boringssl-review.googlesource.com/c/boringssl/+/62226
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-09-01 06:54:59 +00:00
|
|
|
std::move(receiver), render_frame_host,
|
|
|
|
std::make_unique<ElectronPDFDocumentHelperClient>());
|
2022-02-10 02:58:52 +00:00
|
|
|
},
|
|
|
|
&render_frame_host));
|
2021-08-24 00:52:17 +00:00
|
|
|
#endif
|
2019-08-19 20:13:24 +00:00
|
|
|
}
|
|
|
|
|
2018-10-23 08:45:41 +00:00
|
|
|
std::string ElectronBrowserClient::GetApplicationLocale() {
|
2024-01-12 13:50:29 +00:00
|
|
|
return BrowserThread::CurrentlyOn(BrowserThread::IO)
|
|
|
|
? *g_io_thread_application_locale
|
|
|
|
: *g_application_locale;
|
2018-10-23 08:45:41 +00:00
|
|
|
}
|
|
|
|
|
2018-12-05 08:03:39 +00:00
|
|
|
bool ElectronBrowserClient::ShouldEnableStrictSiteIsolation() {
|
|
|
|
// Enable site isolation. It is off by default in Chromium <= 69.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-05 23:41:20 +00:00
|
|
|
void ElectronBrowserClient::BindHostReceiverForRenderer(
|
|
|
|
content::RenderProcessHost* render_process_host,
|
|
|
|
mojo::GenericPendingReceiver receiver) {
|
|
|
|
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
2024-01-03 08:52:49 +00:00
|
|
|
if (auto host_receiver =
|
|
|
|
receiver.As<spellcheck::mojom::SpellCheckInitializationHost>()) {
|
|
|
|
SpellCheckInitializationHostImpl::Create(render_process_host->GetID(),
|
|
|
|
std::move(host_receiver));
|
2019-11-05 23:41:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-02-13 00:39:12 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2024-08-21 20:26:06 +00:00
|
|
|
namespace {
|
2020-02-13 00:39:12 +00:00
|
|
|
void BindMimeHandlerService(
|
|
|
|
content::RenderFrameHost* frame_host,
|
|
|
|
mojo::PendingReceiver<extensions::mime_handler::MimeHandlerService>
|
|
|
|
receiver) {
|
|
|
|
content::WebContents* contents =
|
|
|
|
content::WebContents::FromRenderFrameHost(frame_host);
|
|
|
|
auto* guest_view =
|
|
|
|
extensions::MimeHandlerViewGuest::FromWebContents(contents);
|
|
|
|
if (!guest_view)
|
|
|
|
return;
|
|
|
|
extensions::MimeHandlerServiceImpl::Create(guest_view->GetStreamWeakPtr(),
|
|
|
|
std::move(receiver));
|
|
|
|
}
|
2020-03-11 11:15:07 +00:00
|
|
|
|
|
|
|
void BindBeforeUnloadControl(
|
|
|
|
content::RenderFrameHost* frame_host,
|
|
|
|
mojo::PendingReceiver<extensions::mime_handler::BeforeUnloadControl>
|
|
|
|
receiver) {
|
|
|
|
auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
|
|
|
|
if (!web_contents)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto* guest_view =
|
|
|
|
extensions::MimeHandlerViewGuest::FromWebContents(web_contents);
|
|
|
|
if (!guest_view)
|
|
|
|
return;
|
|
|
|
guest_view->FuseBeforeUnloadControl(std::move(receiver));
|
|
|
|
}
|
2024-08-21 20:26:06 +00:00
|
|
|
} // namespace
|
2020-02-13 00:39:12 +00:00
|
|
|
#endif
|
|
|
|
|
2021-08-30 18:22:46 +00:00
|
|
|
void ElectronBrowserClient::ExposeInterfacesToRenderer(
|
|
|
|
service_manager::BinderRegistry* registry,
|
|
|
|
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
|
|
content::RenderProcessHost* render_process_host) {
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
2023-11-03 19:37:55 +00:00
|
|
|
associated_registry->AddInterface<extensions::mojom::RendererHost>(
|
|
|
|
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
2022-02-25 18:17:35 +00:00
|
|
|
render_process_host->GetID()));
|
2021-08-30 18:22:46 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
|
|
|
content::RenderFrameHost* render_frame_host,
|
2020-05-26 20:06:26 +00:00
|
|
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
2019-12-11 00:22:35 +00:00
|
|
|
map->Add<network_hints::mojom::NetworkHintsHandler>(
|
|
|
|
base::BindRepeating(&BindNetworkHintsHandler));
|
2020-09-08 15:13:56 +00:00
|
|
|
map->Add<blink::mojom::BadgeService>(
|
2021-01-21 05:45:06 +00:00
|
|
|
base::BindRepeating(&badging::BadgeManager::BindFrameReceiver));
|
2021-10-28 14:23:05 +00:00
|
|
|
map->Add<blink::mojom::KeyboardLockService>(base::BindRepeating(
|
|
|
|
&content::KeyboardLockServiceImpl::CreateMojoService));
|
2024-01-03 08:52:49 +00:00
|
|
|
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
|
|
|
|
map->Add<spellcheck::mojom::SpellCheckHost>(base::BindRepeating(
|
|
|
|
[](content::RenderFrameHost* frame_host,
|
|
|
|
mojo::PendingReceiver<spellcheck::mojom::SpellCheckHost> receiver) {
|
|
|
|
SpellCheckHostChromeImpl::Create(frame_host->GetProcess()->GetID(),
|
|
|
|
std::move(receiver));
|
|
|
|
}));
|
|
|
|
#endif
|
2020-02-13 00:39:12 +00:00
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
map->Add<extensions::mime_handler::MimeHandlerService>(
|
|
|
|
base::BindRepeating(&BindMimeHandlerService));
|
2020-03-11 11:15:07 +00:00
|
|
|
map->Add<extensions::mime_handler::BeforeUnloadControl>(
|
|
|
|
base::BindRepeating(&BindBeforeUnloadControl));
|
|
|
|
|
|
|
|
content::WebContents* web_contents =
|
|
|
|
content::WebContents::FromRenderFrameHost(render_frame_host);
|
|
|
|
if (!web_contents)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const GURL& site = render_frame_host->GetSiteInstance()->GetSiteURL();
|
|
|
|
if (!site.SchemeIs(extensions::kExtensionScheme))
|
|
|
|
return;
|
|
|
|
|
|
|
|
content::BrowserContext* browser_context =
|
|
|
|
render_frame_host->GetProcess()->GetBrowserContext();
|
|
|
|
auto* extension = extensions::ExtensionRegistry::Get(browser_context)
|
|
|
|
->enabled_extensions()
|
|
|
|
.GetByID(site.host());
|
|
|
|
if (!extension)
|
|
|
|
return;
|
|
|
|
extensions::ExtensionsBrowserClient::Get()
|
|
|
|
->RegisterBrowserInterfaceBindersForFrame(map, render_frame_host,
|
|
|
|
extension);
|
2020-02-13 00:39:12 +00:00
|
|
|
#endif
|
2019-12-11 00:22:35 +00:00
|
|
|
}
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2020-05-07 20:31:26 +00:00
|
|
|
void ElectronBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
|
|
|
const base::CommandLine& command_line,
|
|
|
|
int child_process_id,
|
|
|
|
content::PosixFileDescriptorInfo* mappings) {
|
|
|
|
int crash_signal_fd = GetCrashSignalFD(command_line);
|
|
|
|
if (crash_signal_fd >= 0) {
|
2020-10-16 01:30:41 +00:00
|
|
|
mappings->Share(kCrashDumpSignal, crash_signal_fd);
|
2020-05-07 20:31:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-11-11 17:47:01 +00:00
|
|
|
std::unique_ptr<content::LoginDelegate>
|
|
|
|
ElectronBrowserClient::CreateLoginDelegate(
|
|
|
|
const net::AuthChallengeInfo& auth_info,
|
|
|
|
content::WebContents* web_contents,
|
2024-01-25 17:46:30 +00:00
|
|
|
content::BrowserContext* browser_context,
|
2019-11-11 17:47:01 +00:00
|
|
|
const content::GlobalRequestID& request_id,
|
|
|
|
bool is_main_frame,
|
|
|
|
const GURL& url,
|
|
|
|
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
|
|
|
bool first_auth_attempt,
|
|
|
|
LoginAuthRequiredCallback auth_required_callback) {
|
|
|
|
return std::make_unique<LoginHandler>(
|
2024-08-14 02:36:47 +00:00
|
|
|
auth_info, web_contents, is_main_frame, base::kNullProcessId, url,
|
|
|
|
response_headers, first_auth_attempt, std::move(auth_required_callback));
|
2019-11-11 17:47:01 +00:00
|
|
|
}
|
|
|
|
|
2020-02-13 00:39:12 +00:00
|
|
|
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
|
|
|
|
ElectronBrowserClient::CreateURLLoaderThrottles(
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
|
|
|
content::NavigationUIData* navigation_ui_data,
|
2024-01-25 17:46:30 +00:00
|
|
|
int frame_tree_node_id,
|
|
|
|
absl::optional<int64_t> navigation_id) {
|
2020-02-13 00:39:12 +00:00
|
|
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> result;
|
|
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
result.push_back(std::make_unique<PluginResponseInterceptorURLLoaderThrottle>(
|
2021-02-09 20:16:21 +00:00
|
|
|
request.destination, frame_tree_node_id));
|
2020-02-13 00:39:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
base::flat_set<std::string>
|
|
|
|
ElectronBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
|
|
|
content::BrowserContext* browser_context) {
|
|
|
|
base::flat_set<std::string> mime_types;
|
|
|
|
#if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
|
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context);
|
|
|
|
for (const auto& pair : map)
|
|
|
|
mime_types.insert(pair.first);
|
2022-03-25 01:39:03 +00:00
|
|
|
#endif
|
|
|
|
#if BUILDFLAG(ENABLE_PDF_VIEWER)
|
|
|
|
mime_types.insert(pdf::kInternalPluginMimeType);
|
2020-02-13 00:39:12 +00:00
|
|
|
#endif
|
|
|
|
return mime_types;
|
|
|
|
}
|
|
|
|
|
2020-09-28 16:22:03 +00:00
|
|
|
content::SerialDelegate* ElectronBrowserClient::GetSerialDelegate() {
|
|
|
|
if (!serial_delegate_)
|
|
|
|
serial_delegate_ = std::make_unique<ElectronSerialDelegate>();
|
|
|
|
return serial_delegate_.get();
|
|
|
|
}
|
|
|
|
|
2021-02-26 19:10:27 +00:00
|
|
|
content::BluetoothDelegate* ElectronBrowserClient::GetBluetoothDelegate() {
|
|
|
|
if (!bluetooth_delegate_)
|
|
|
|
bluetooth_delegate_ = std::make_unique<ElectronBluetoothDelegate>();
|
|
|
|
return bluetooth_delegate_.get();
|
|
|
|
}
|
|
|
|
|
2022-11-22 21:50:32 +00:00
|
|
|
content::UsbDelegate* ElectronBrowserClient::GetUsbDelegate() {
|
|
|
|
if (!usb_delegate_)
|
|
|
|
usb_delegate_ = std::make_unique<ElectronUsbDelegate>();
|
|
|
|
return usb_delegate_.get();
|
|
|
|
}
|
|
|
|
|
2024-08-21 20:26:06 +00:00
|
|
|
namespace {
|
|
|
|
|
2021-04-27 21:27:34 +00:00
|
|
|
void BindBadgeServiceForServiceWorker(
|
|
|
|
const content::ServiceWorkerVersionBaseInfo& info,
|
2021-03-15 22:43:25 +00:00
|
|
|
mojo::PendingReceiver<blink::mojom::BadgeService> receiver) {
|
2021-04-27 21:27:34 +00:00
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
|
|
|
|
content::RenderProcessHost* render_process_host =
|
|
|
|
content::RenderProcessHost::FromID(info.process_id);
|
|
|
|
if (!render_process_host)
|
|
|
|
return;
|
|
|
|
|
2021-03-15 22:43:25 +00:00
|
|
|
badging::BadgeManager::BindServiceWorkerReceiver(
|
2021-04-27 21:27:34 +00:00
|
|
|
render_process_host, info.scope, std::move(receiver));
|
|
|
|
}
|
|
|
|
|
2024-08-21 20:26:06 +00:00
|
|
|
} // namespace
|
|
|
|
|
2021-04-27 21:27:34 +00:00
|
|
|
void ElectronBrowserClient::RegisterBrowserInterfaceBindersForServiceWorker(
|
2022-07-13 21:26:16 +00:00
|
|
|
content::BrowserContext* browser_context,
|
2022-10-03 20:21:00 +00:00
|
|
|
const content::ServiceWorkerVersionBaseInfo& service_worker_version_info,
|
2021-04-27 21:27:34 +00:00
|
|
|
mojo::BinderMapWithContext<const content::ServiceWorkerVersionBaseInfo&>*
|
|
|
|
map) {
|
|
|
|
map->Add<blink::mojom::BadgeService>(
|
|
|
|
base::BindRepeating(&BindBadgeServiceForServiceWorker));
|
2021-03-15 22:43:25 +00:00
|
|
|
}
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2024-03-15 18:03:42 +00:00
|
|
|
device::GeolocationSystemPermissionManager*
|
|
|
|
ElectronBrowserClient::GetGeolocationSystemPermissionManager() {
|
|
|
|
return device::GeolocationSystemPermissionManager::GetInstance();
|
2021-06-29 03:26:57 +00:00
|
|
|
}
|
2023-03-16 10:03:53 +00:00
|
|
|
#endif
|
2021-06-29 03:26:57 +00:00
|
|
|
|
2021-09-23 11:00:11 +00:00
|
|
|
content::HidDelegate* ElectronBrowserClient::GetHidDelegate() {
|
|
|
|
if (!hid_delegate_)
|
|
|
|
hid_delegate_ = std::make_unique<ElectronHidDelegate>();
|
|
|
|
return hid_delegate_.get();
|
|
|
|
}
|
|
|
|
|
2022-09-20 22:47:42 +00:00
|
|
|
content::WebAuthenticationDelegate*
|
|
|
|
ElectronBrowserClient::GetWebAuthenticationDelegate() {
|
|
|
|
if (!web_authentication_delegate_) {
|
|
|
|
web_authentication_delegate_ =
|
|
|
|
std::make_unique<ElectronWebAuthenticationDelegate>();
|
|
|
|
}
|
|
|
|
return web_authentication_delegate_.get();
|
|
|
|
}
|
|
|
|
|
2013-04-12 01:46:58 +00:00
|
|
|
} // namespace electron
|