From 8f7a48879ef8633a76279803637cdee7f7c6cd4f Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <84116207+electron-roller[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 19:59:39 -0400 Subject: [PATCH] chore: bump chromium to 119.0.6045.0 (main) (#40076) * chore: bump chromium in DEPS to 119.0.6045.0 * chore: update patches * 4864948: Remove legacy-legacy https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4864948 * 4907760: Remove ui/base/glib/glib_signal.h https://chromium-review.googlesource.com/c/chromium/src/+/4907760 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt --- DEPS | 2 +- .../add_didinstallconditionalfeatures.patch | 12 +- ..._depend_on_packed_resource_integrity.patch | 14 +- ...ld_config_in_the_required_components.patch | 4 +- patches/chromium/can_create_window.patch | 4 +- ...d_buildflag_guard_around_new_include.patch | 2 +- ...hore_add_electron_deps_to_gitignores.patch | 6 +- ...xpose_setuseragent_on_networkcontext.patch | 8 +- ..._registry_to_multibuffer_data_source.patch | 14 +- ...ding_non-standard_schemes_in_iframes.patch | 4 +- ...x_harden_blink_scriptstate_maybefrom.patch | 6 +- ...from_localframe_requestexecutescript.patch | 4 +- patches/chromium/frame_host_manager.patch | 4 +- .../chromium/gritsettings_resource_ids.patch | 4 +- .../mas_disable_remote_accessibility.patch | 2 +- ...emote_certificate_verification_logic.patch | 10 +- patches/chromium/printing.patch | 32 +- .../worker_context_will_destroy.patch | 4 +- ...feat_add_hook_to_notify_script_ready.patch | 4 +- ...bals_to_allow_patching_devtools_dock.patch | 285 +++++++++++++++++- .../linux/libnotify_notification.cc | 17 +- .../linux/libnotify_notification.h | 17 +- shell/browser/ui/file_dialog_gtk.cc | 25 +- shell/browser/ui/gtk/menu_gtk.cc | 6 +- shell/browser/ui/gtk/menu_gtk.h | 5 +- shell/browser/ui/gtk/menu_util.cc | 14 +- shell/browser/ui/gtk/menu_util.h | 12 +- shell/browser/ui/message_box_gtk.cc | 23 +- shell/browser/ui/status_icon_gtk.cc | 13 +- shell/browser/ui/status_icon_gtk.h | 14 +- .../ui/views/global_menu_bar_registrar_x11.cc | 31 +- .../ui/views/global_menu_bar_registrar_x11.h | 18 +- shell/browser/ui/views/global_menu_bar_x11.cc | 14 +- shell/browser/ui/views/global_menu_bar_x11.h | 11 +- 34 files changed, 472 insertions(+), 173 deletions(-) diff --git a/DEPS b/DEPS index f6c27358472c..ca3b3161b971 100644 --- a/DEPS +++ b/DEPS @@ -2,7 +2,7 @@ gclient_gn_args_from = 'src' vars = { 'chromium_version': - '119.0.6043.0', + '119.0.6045.0', 'node_version': 'v18.18.0', 'nan_version': diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 81e760fdeb07..beb00af7ae99 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index d1e9ad95891487b37e2e03cb2a220eb969e877ab..13bdc6cf7ba4221f0a3219975a0825eb62dd0b78 100644 +index a4bf5bb618510ef5ef2ab2d05405cfd3688e97af..7a12c0ecb7254fe335c5563f3fd04c629abe065f 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -139,6 +139,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, +@@ -140,6 +140,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local context, int32_t world_id) {} @@ -23,10 +23,10 @@ index d1e9ad95891487b37e2e03cb2a220eb969e877ab..13bdc6cf7ba4221f0a3219975a0825eb int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index fb4a6b297990e687cc11cb5cc1f368c7cbcd2950..7644e2c2d80885e5241a4eada9d562354e793953 100644 +index 925b1a7b72bba63a2f2f10da9da1814ff94711e0..345b15d2ee2f5f3b08f63801ee179bfe7a8e330e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4431,6 +4431,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4441,6 +4441,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index fb4a6b297990e687cc11cb5cc1f368c7cbcd2950..7644e2c2d80885e5241a4eada9d56235 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 392544432dea3d707fc1aca041c9e1805144b902..908fe8b36a46b89adf4751b0028f68457ed11e12 100644 +index 9afa054b3927a9441824ba7b34737d0951d85021..8ed97dce0ee37207f6b77c04432f7c18c90faa0b 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -610,6 +610,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -612,6 +612,8 @@ class CONTENT_EXPORT RenderFrameImpl void DidObserveLayoutShift(double score, bool after_input_or_scroll) override; void DidCreateScriptContext(v8::Local context, int world_id) override; diff --git a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch index ce742b878d79..f20f7dd68819 100644 --- a/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch +++ b/patches/chromium/build_do_not_depend_on_packed_resource_integrity.patch @@ -33,10 +33,10 @@ index dcf02923c21e1c4c292eb800f6325e4bb764c823..8738860b44f179685198d2c0b9729fcc "//base", "//build:branding_buildflags", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index a214247d2c25052ef2f6aae8104cd27e6658f638..42bc2f85197ce52f861229f671144ed62892ae8e 100644 +index 157ee5cadc0a7bf97be0fc8bf34adb858beea1f1..20303e1712ff917a6c145ab9b1bd71524d998a7f 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -4793,7 +4793,7 @@ static_library("browser") { +@@ -4797,7 +4797,7 @@ static_library("browser") { # On Windows, the hashes are embedded in //chrome:chrome_initial rather # than here in :chrome_dll. @@ -46,10 +46,10 @@ index a214247d2c25052ef2f6aae8104cd27e6658f638..42bc2f85197ce52f861229f671144ed6 sources += [ "certificate_viewer_stub.cc" ] } diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn -index 3742394f9fd091bfcdb72259272862e7e389dc31..dedc8d445bf76365eaa1aea4e83f25cb0f44b5f2 100644 +index 6b98993d6737c22883bd9ddb31eda60060795e94..d1c6cce7ed68d1d523bd6683529e6ab003ace8e7 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -6892,7 +6892,6 @@ test("unit_tests") { +@@ -6899,7 +6899,6 @@ test("unit_tests") { deps += [ "//chrome:other_version", @@ -57,7 +57,7 @@ index 3742394f9fd091bfcdb72259272862e7e389dc31..dedc8d445bf76365eaa1aea4e83f25cb "//chrome//services/util_win:unit_tests", "//chrome/app:chrome_dll_resources", "//chrome/app:win_unit_tests", -@@ -6913,6 +6912,10 @@ test("unit_tests") { +@@ -6920,6 +6919,10 @@ test("unit_tests") { "//ui/resources", ] @@ -68,7 +68,7 @@ index 3742394f9fd091bfcdb72259272862e7e389dc31..dedc8d445bf76365eaa1aea4e83f25cb ldflags = [ "/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll", "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll", -@@ -7896,7 +7899,6 @@ test("unit_tests") { +@@ -7905,7 +7908,6 @@ test("unit_tests") { } deps += [ @@ -76,7 +76,7 @@ index 3742394f9fd091bfcdb72259272862e7e389dc31..dedc8d445bf76365eaa1aea4e83f25cb "//chrome/browser/apps:icon_standardizer", "//chrome/browser/apps/app_service", "//chrome/browser/apps/app_service:app_registry_cache_waiter", -@@ -7982,6 +7984,10 @@ test("unit_tests") { +@@ -7992,6 +7994,10 @@ test("unit_tests") { "//ui/webui/resources/js/browser_command:mojo_bindings", ] diff --git a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch index 619b294d663a..1e23e5657cb7 100644 --- a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch +++ b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch @@ -6,7 +6,7 @@ Subject: build: only use the mas build config in the required components Before landing this patch should be split into the relevant MAS patches, or at least the patch this one partially reverts diff --git a/base/BUILD.gn b/base/BUILD.gn -index 4a227a6c54c92efa72247128b789ed47961c6299..ab7e276b842f0df7f281d9a75ee268d5fb66f6dc 100644 +index 55479f4187323ad0f26dbbda555c0ff3093cc8d5..a9cf41bce37672d355373568b04fbda45210a6d8 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1032,6 +1032,7 @@ component("base") { @@ -249,7 +249,7 @@ index 4e23c38763184840a393589b3f55dcabb0db8121..e4ad30d0d7acecdca3a22fe05935a340 if (use_atk) { diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 88b443dab9a3e485a3a99bf7cfd5c726c762cbe1..be7b6d48dde6d4d1b3ecb69153f81348f00f6632 100644 +index ebdd885b00da86656bec13fb45a763ef49209d3e..614d07f318870db973f47d41f935c03f08970736 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn @@ -359,6 +359,7 @@ component("base") { diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 0fe687375b4d..82c99ce511d6 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -148,10 +148,10 @@ index 0fa12e6a5dd2eb2cd2102919f6127731e8500133..64ac8d677a9f7a723c46bbf0e74595b3 // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 6cb31125694256dd65878373411109c59a8fa2e1..fb4a6b297990e687cc11cb5cc1f368c7cbcd2950 100644 +index 47a2bc8e75e24ca61772f65140bbb2f868e63788..925b1a7b72bba63a2f2f10da9da1814ff94711e0 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -6354,6 +6354,10 @@ WebView* RenderFrameImpl::CreateNewWindow( +@@ -6364,6 +6364,10 @@ WebView* RenderFrameImpl::CreateNewWindow( request.HasUserGesture(), GetWebFrame()->IsAdFrame(), GetWebFrame()->IsAdScriptInStack()); diff --git a/patches/chromium/chore_add_buildflag_guard_around_new_include.patch b/patches/chromium/chore_add_buildflag_guard_around_new_include.patch index c4740e54f6b5..f9f825c1b376 100644 --- a/patches/chromium/chore_add_buildflag_guard_around_new_include.patch +++ b/patches/chromium/chore_add_buildflag_guard_around_new_include.patch @@ -9,7 +9,7 @@ This is an experimental commit; but if it's successful, This patch should be upstreamed and then removed from electron's code. diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h -index b8583874ec98cdadf2f9cc6ed5e378068fe462cd..95562238ba617e870a65ca7d080eae7b3ee9f298 100644 +index f6251860d8bd387b31e748ede3d4a4a0d5c1ff8c..ca4df8d7ebda791e55932eaf512215da55fbdf49 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -43,7 +43,6 @@ diff --git a/patches/chromium/chore_add_electron_deps_to_gitignores.patch b/patches/chromium/chore_add_electron_deps_to_gitignores.patch index 485f43caf5a9..3dc31537ba2a 100644 --- a/patches/chromium/chore_add_electron_deps_to_gitignores.patch +++ b/patches/chromium/chore_add_electron_deps_to_gitignores.patch @@ -18,7 +18,7 @@ index 22417f27125a44d481483439066d73e60348b414..82e5084b0e12231e5cc96a38d99b7238 /googleurl /gpu/gles2_conform_test diff --git a/third_party/.gitignore b/third_party/.gitignore -index 3f2f87ce4907764225a5e69d37bbc05c840dadf5..2197d5ef6b6eeca4cb50a82ee8d0021c0edcb122 100644 +index 2d9aed0c5f27d34e586180214028fb9c6af6fbb4..f3c8d474c067f7012b42be1491c1e1f96e8e810f 100644 --- a/third_party/.gitignore +++ b/third_party/.gitignore @@ -51,6 +51,7 @@ @@ -29,7 +29,7 @@ index 3f2f87ce4907764225a5e69d37bbc05c840dadf5..2197d5ef6b6eeca4cb50a82ee8d0021c /elfutils/src /espresso/lib/ /eyesfree/src -@@ -111,6 +112,7 @@ +@@ -110,6 +111,7 @@ /mocha /mockito/src /nacl_sdk_binaries/ @@ -37,7 +37,7 @@ index 3f2f87ce4907764225a5e69d37bbc05c840dadf5..2197d5ef6b6eeca4cb50a82ee8d0021c /ninja/ninja* /node/*.tar.gz /node/linux/ -@@ -154,6 +156,7 @@ +@@ -153,6 +155,7 @@ /soda-win64 /speex /sqlite4java/lib/ diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 41e106ab3f21..f0d64abd489a 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,7 +33,7 @@ index 0ab8187b0db8ae6db46d81738f653a2bc4c566f6..de3d55e85c22317f7f9375eb94d0d5d4 } // namespace net diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 04a0a7a581f2daafc8929e61fcc6980e6070c3b2..d1911725facdcf32edd75ba6463068685b43ba2c 100644 +index f2b36dbd52bc59928ea14b6adb30005f6505ab19..36c07c1a0371274ff93a86e388b2a6d541cdf614 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -1558,6 +1558,13 @@ void NetworkContext::SetNetworkConditions( @@ -51,7 +51,7 @@ index 04a0a7a581f2daafc8929e61fcc6980e6070c3b2..d1911725facdcf32edd75ba646306868 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index 9bd43e9e373b74f2f8fcc8f12ab0e0c38927dfcb..0112afaa651e75af56abe5ca51b11d9bb001e51b 100644 +index c81ae450479d994a89f4d9560028ecd761e8e74f..eb181df1e63fe10734f4eb7d39a28705affa0bca 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -316,6 +316,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext @@ -63,10 +63,10 @@ index 9bd43e9e373b74f2f8fcc8f12ab0e0c38927dfcb..0112afaa651e75af56abe5ca51b11d9b void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CHROMEOS) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 05b77489e5dc30194d90c7e01b2342906af73d5d..8a0ed8bca1bd58c9750be7a2469cf674574cc241 100644 +index 5d20e33a59de709a8e21630de2e1c357c5a68dfd..b736e555a1ce8ba513fe94ef8f52d95c4b7b120e 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1232,6 +1232,9 @@ interface NetworkContext { +@@ -1240,6 +1240,9 @@ interface NetworkContext { SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id, NetworkConditions? conditions); diff --git a/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch b/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch index fdb6236561c2..54d89894618b 100644 --- a/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch +++ b/patches/chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch @@ -13,13 +13,13 @@ other protocols to register their streaming behavior. MultibufferDataSource::Ass then refers to the list so that it can correctly determine the data source's settings. diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc -index 2b5c5f059159865cb84a7efcefe47cd788d5f5ee..1627649fb5085c637cde556074b242c4939c81de 100644 +index 30558fdfc35755fbc35f9eab7db2356e038c1884..3232629b263acae147a56864ebd73caf59b39789 100644 --- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc +++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.cc -@@ -11,8 +11,10 @@ - #include "base/functional/bind.h" +@@ -12,8 +12,10 @@ #include "base/functional/callback_helpers.h" #include "base/location.h" + #include "base/memory/raw_ptr.h" +#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "base/task/single_thread_task_runner.h" @@ -27,7 +27,7 @@ index 2b5c5f059159865cb84a7efcefe47cd788d5f5ee..1627649fb5085c637cde556074b242c4 #include "media/base/media_log.h" #include "net/base/net_errors.h" #include "third_party/blink/renderer/platform/media/buffered_data_source_host_impl.h" -@@ -61,8 +63,20 @@ const int kUpdateBufferSizeFrequency = 32; +@@ -62,8 +64,20 @@ const int kUpdateBufferSizeFrequency = 32; // How long to we delay a seek after a read? constexpr base::TimeDelta kSeekDelay = base::Milliseconds(20); @@ -48,7 +48,7 @@ index 2b5c5f059159865cb84a7efcefe47cd788d5f5ee..1627649fb5085c637cde556074b242c4 class MultiBufferDataSource::ReadOperation { public: ReadOperation() = delete; -@@ -154,7 +168,14 @@ bool MultiBufferDataSource::media_has_played() const { +@@ -155,7 +169,14 @@ bool MultiBufferDataSource::media_has_played() const { bool MultiBufferDataSource::AssumeFullyBuffered() const { DCHECK(url_data_); @@ -65,10 +65,10 @@ index 2b5c5f059159865cb84a7efcefe47cd788d5f5ee..1627649fb5085c637cde556074b242c4 void MultiBufferDataSource::SetReader(MultiBufferReader* reader) { diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h -index 8d6408c7ebe7d216c9d81332e8db32ff9e223f90..5174ddd895345b90d8181136fd4325550541a2d0 100644 +index c5093eea3f0f354d3ac7358a92f3d1a3dfa849b2..eb6c49c52b4f511db9c99735544c541ed64870ba 100644 --- a/third_party/blink/renderer/platform/media/multi_buffer_data_source.h +++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source.h -@@ -33,6 +33,8 @@ namespace blink { +@@ -34,6 +34,8 @@ namespace blink { class BufferedDataSourceHost; class MultiBufferReader; diff --git a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch index 88710dfde4d6..f552374445ea 100644 --- a/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch +++ b/patches/chromium/fix_crash_loading_non-standard_schemes_in_iframes.patch @@ -23,7 +23,7 @@ Upstream bug https://bugs.chromium.org/p/chromium/issues/detail?id=1081397. Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3856266. diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 3fd2f30e7cf18ee0deccb78907d596dac30c310f..62f49e166dc86fdab9b163ea58d391c60ea38415 100644 +index 68b50260715c2a56bacf0f2e856f761c793ff143..e457ea82f6dd9ab8a3f1683bda61f6513f8abd00 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc @@ -799,6 +799,12 @@ GetOriginForURLLoaderFactoryUncheckedWithDebugInfo( @@ -40,7 +40,7 @@ index 3fd2f30e7cf18ee0deccb78907d596dac30c310f..62f49e166dc86fdab9b163ea58d391c6 // origin of |common_params.url| and/or |common_params.initiator_origin|. return std::make_pair( diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc -index de9a6d9f6921b91fb20930d61a7a4466b6642777..fe8838648bfc1fa4ad4d8d5491d3d7329de3607a 100644 +index 9b0ad2483fcf02d8d46dcf222541b0a4b34984c0..d5f99b20fbe5242f95935918fedaf3e00d771ab9 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc @@ -2054,6 +2054,10 @@ Frame* DocumentLoader::CalculateOwnerFrame() { diff --git a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch index c72b3c340436..168ce66fa3b2 100644 --- a/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch +++ b/patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch @@ -86,10 +86,10 @@ index 7ff8785cd64c1264a88f91f7bd3292c6943f58ea..bc14ad8cab9fa3ec45bcb9f670b19897 // Cut the reference from ScriptState to V8 context. diff --git a/third_party/blink/renderer/platform/bindings/script_state.h b/third_party/blink/renderer/platform/bindings/script_state.h -index 8be11a1315b02747c9132bd1b9e0cb7589467db8..d75a5db82a5347bd63def93f03793de90f91c4d0 100644 +index 7c3cbdf73198f5592bff3e4fba8088f774efb0dd..ce3a01ded69eb10756e9a79f776afd3c22b8c931 100644 --- a/third_party/blink/renderer/platform/bindings/script_state.h +++ b/third_party/blink/renderer/platform/bindings/script_state.h -@@ -181,7 +181,12 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { +@@ -182,7 +182,12 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { static ScriptState* MaybeFrom(v8::Local context) { DCHECK(!context.IsEmpty()); if (context->GetNumberOfEmbedderDataFields() <= @@ -103,7 +103,7 @@ index 8be11a1315b02747c9132bd1b9e0cb7589467db8..d75a5db82a5347bd63def93f03793de9 return nullptr; } ScriptState* script_state = -@@ -256,9 +261,15 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { +@@ -257,9 +262,15 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected { static void SetCreateCallback(CreateCallback); friend class ScriptStateImpl; diff --git a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch index 1b5f501e0097..35e9695db94f 100644 --- a/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch +++ b/patches/chromium/fix_return_v8_value_from_localframe_requestexecutescript.patch @@ -8,10 +8,10 @@ v8::Value instead of base::Value. Refs https://bugs.chromium.org/p/chromium/issues/detail?id=1323953 diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc -index 34777e89362b14587979cef76d8cd71b634cca8c..3d5e44883bab30eebdfaba70f3933435fe946ca1 100644 +index 6c924dcf068a1ba2fe647a0a6b34d981d3dad570..febd81af331c06d9aaf1dda14be2718a1c5689d9 100644 --- a/extensions/renderer/script_injection.cc +++ b/extensions/renderer/script_injection.cc -@@ -275,6 +275,7 @@ void ScriptInjection::InjectJs(std::set* executing_scripts, +@@ -276,6 +276,7 @@ void ScriptInjection::InjectJs(std::set* executing_scripts, blink::mojom::LoadEventBlockingOption::kBlock, base::BindOnce(&ScriptInjection::OnJsInjectionCompleted, weak_ptr_factory_.GetWeakPtr()), diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 3b12b81ffe2a..134a98fa7af5 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -6,10 +6,10 @@ Subject: frame_host_manager.patch Allows embedder to intercept site instances created by chromium. diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 4dcb9d4b52d78782602a22617971185f95850090..fea14bc71daae7b638e04c2b28919c23a1c6ce0f 100644 +index 331975fb93f435fc6ebe756113cee74cf7b61c56..f39fe9c4d85f351df8adeea8f32c3dd568311577 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -4211,6 +4211,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -4222,6 +4222,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index a14b9c5d827a..42da75ed0cec 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index ec4710e8df2e8fe678cecc39c92d95e086eeeb7e..c596b66cc7fd45596119140203a41da5a2817e00 100644 +index 99322038017ccbb65ced6a8d49ed6a2c7815caed..6db47e8ce5ea95df040626e5c6459bd55f36ce37 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -1234,6 +1234,11 @@ +@@ -1238,6 +1238,11 @@ "includes": [7440], }, diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch index 641fb0f99461..39f583af7be0 100644 --- a/patches/chromium/mas_disable_remote_accessibility.patch +++ b/patches/chromium/mas_disable_remote_accessibility.patch @@ -200,7 +200,7 @@ index 6f95c717849b0ba1795e018e237625e221fd4ced..d9888a6c4bc5b6e6a386aeebd035cdc7 /////////////////////////////////////////////////////////////////////////////// diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 6eb8ca650c74b858be07b4c42da3fbd089123317..88b443dab9a3e485a3a99bf7cfd5c726c762cbe1 100644 +index 099dd572b6b258b3214743bee63125c6bc30e0c5..ebdd885b00da86656bec13fb45a763ef49209d3e 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn @@ -376,6 +376,13 @@ component("base") { diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 32d8bde4f58f..e76f72e7dc9d 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index a88d8177dc8ac02c81ec79e10e2c937eca002ff7..04a0a7a581f2daafc8929e61fcc6980e6070c3b2 100644 +index 0a0fa8772cab92d23a8b75aded6c1dbcf29e7b94..f2b36dbd52bc59928ea14b6adb30005f6505ab19 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -145,6 +145,11 @@ @@ -147,7 +147,7 @@ index a88d8177dc8ac02c81ec79e10e2c937eca002ff7..04a0a7a581f2daafc8929e61fcc6980e builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index 3f51ecd9694c900ffb21d7e9ec5d737387ea39ca..9bd43e9e373b74f2f8fcc8f12ab0e0c38927dfcb 100644 +index ef4140d740e233964e1db25d3239a8807f591e2d..c81ae450479d994a89f4d9560028ecd761e8e74f 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -114,6 +114,7 @@ class URLMatcher; @@ -167,7 +167,7 @@ index 3f51ecd9694c900ffb21d7e9ec5d737387ea39ca..9bd43e9e373b74f2f8fcc8f12ab0e0c3 void ResetURLLoaderFactories() override; void GetViaObliviousHttp( mojom::ObliviousHttpRequestPtr request, -@@ -899,6 +902,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -904,6 +907,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext std::vector dismount_closures_; #endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED) @@ -177,7 +177,7 @@ index 3f51ecd9694c900ffb21d7e9ec5d737387ea39ca..9bd43e9e373b74f2f8fcc8f12ab0e0c3 std::unique_ptr internal_host_resolver_; // Map values set to non-null only if that HostResolver has its own private diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index d790176f8cfec7368f0513f95fd94ded25e8fd13..05b77489e5dc30194d90c7e01b2342906af73d5d 100644 +index 3d95f8cd1adebd11a57ec7fd5152ac89e30e28bc..5d20e33a59de709a8e21630de2e1c357c5a68dfd 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -316,6 +316,17 @@ struct NetworkContextFilePaths { @@ -198,7 +198,7 @@ index d790176f8cfec7368f0513f95fd94ded25e8fd13..05b77489e5dc30194d90c7e01b234290 // Parameters for constructing a network context. struct NetworkContextParams { // The user agent string. -@@ -941,6 +952,9 @@ interface NetworkContext { +@@ -949,6 +960,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote client); diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 2a3ea50bc200..08cd46bb9def 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -706,10 +706,10 @@ index 3f9a514fb41d72c5d06de6ac989f9d7c0513a4e7..0e7ada9df962808dad7caf074a08ebde // Tells the browser printing failed. PrintingFailed(int32 cookie, PrintFailureReason reason); diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c13038abb 100644 +index ab80b6840e97c112db0fab65e4d0d3fa61f186dd..9524b79c3a9b770312a064e5c25fa0a0d95cd1ed 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc -@@ -45,6 +45,7 @@ +@@ -47,6 +47,7 @@ #include "printing/mojom/print.mojom.h" #include "printing/page_number.h" #include "printing/print_job_constants.h" @@ -717,7 +717,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c #include "printing/units.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" -@@ -1211,14 +1212,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1215,14 +1216,14 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { } print_in_progress_ = true; @@ -734,7 +734,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c if (!weak_this) { return; } -@@ -1249,7 +1250,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1253,7 +1254,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -743,7 +743,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; -@@ -1264,7 +1265,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { +@@ -1268,7 +1269,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { // plugin node and print that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -752,7 +752,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c if (render_frame_gone_) { return; -@@ -1353,7 +1354,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { +@@ -1357,7 +1358,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { } Print(frame, print_preview_context_.source_node(), @@ -762,7 +762,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c if (render_frame_gone_) { return; } -@@ -1416,6 +1418,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { +@@ -1420,6 +1422,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) { if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) return; @@ -771,7 +771,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c print_preview_context_.OnPrintPreview(); #if BUILDFLAG(IS_CHROMEOS_ASH) -@@ -2040,7 +2044,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -2044,7 +2048,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { } Print(duplicate_node.GetDocument().GetFrame(), duplicate_node, @@ -781,7 +781,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c // Check if `this` is still valid. if (!weak_this) { return; -@@ -2056,17 +2061,19 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -2060,17 +2065,19 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -804,7 +804,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c DidFinishPrinting(PrintingResult::kFailPrintInit); return; } -@@ -2087,8 +2094,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -2091,8 +2098,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, print_pages_params_->params->print_scaling_option; auto self = weak_ptr_factory_.GetWeakPtr(); @@ -821,7 +821,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c // Check if `this` is still valid. if (!self) return; -@@ -2327,25 +2341,33 @@ void PrintRenderFrameHelper::IPCProcessed() { +@@ -2331,25 +2345,33 @@ void PrintRenderFrameHelper::IPCProcessed() { } bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame, @@ -861,7 +861,7 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c return true; } -@@ -2452,7 +2474,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser( +@@ -2456,7 +2478,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser( std::move(params), base::BindOnce( [](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output, @@ -871,10 +871,10 @@ index 514bf6a4491cf2f619e6e7c71f907af3c5cc92ca..d83153866456e33f9333ceec064e261c std::move(quit_closure).Run(); }, diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h -index 45b63865e34e6d8225e11e9b74d864f40dce5f4a..d175ab1e3aa7612467a4eb06464e1d2bfd02b243 100644 +index c68b68767ac52602981278ec655d9ccfad0c30ab..df2ea4524584417d859e1a22ec8a49c88e534ae3 100644 --- a/components/printing/renderer/print_render_frame_helper.h +++ b/components/printing/renderer/print_render_frame_helper.h -@@ -247,7 +247,7 @@ class PrintRenderFrameHelper +@@ -248,7 +248,7 @@ class PrintRenderFrameHelper mojo::PendingAssociatedReceiver receiver); // printing::mojom::PrintRenderFrame: @@ -883,7 +883,7 @@ index 45b63865e34e6d8225e11e9b74d864f40dce5f4a..d175ab1e3aa7612467a4eb06464e1d2b void PrintWithParams(mojom::PrintPagesParamsPtr params, PrintWithParamsCallback callback) override; #if BUILDFLAG(ENABLE_PRINT_PREVIEW) -@@ -317,7 +317,9 @@ class PrintRenderFrameHelper +@@ -318,7 +318,9 @@ class PrintRenderFrameHelper // WARNING: |this| may be gone after this method returns. void Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -894,7 +894,7 @@ index 45b63865e34e6d8225e11e9b74d864f40dce5f4a..d175ab1e3aa7612467a4eb06464e1d2b // Notification when printing is done - signal tear-down/free resources. void DidFinishPrinting(PrintingResult result); -@@ -327,7 +329,8 @@ class PrintRenderFrameHelper +@@ -328,7 +330,8 @@ class PrintRenderFrameHelper // Initialize print page settings with default settings. // Used only for native printing workflow. bool InitPrintSettings(blink::WebLocalFrame* frame, diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 0a11f6c0b904..f5dc5831307c 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -43,10 +43,10 @@ index cddb519c4c893607e56ea44e17e75783fb33d373..0a3a36d2650d7aa3edb50f37898be205 const v8::Local& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 4813c8ce4525f047b45aab0bd02135d5cf73f1e2..5e54ca5d408716dc058287efceab4c8924344c54 100644 +index 84c36d410a352f5d980fb8313356b6f6efcb0516..f2896f8b3e6164f967e06f385a0b399bd0847bfb 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -173,6 +173,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -174,6 +174,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 235c5e166203..0a61a593eb5b 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -52,10 +52,10 @@ index 0a3a36d2650d7aa3edb50f37898be20500fc99e5..63fe14db69116258a874117232c193f4 const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 5e54ca5d408716dc058287efceab4c8924344c54..1ecc1079ecd2345138cb1a11498b6f721f611363 100644 +index f2896f8b3e6164f967e06f385a0b399bd0847bfb..be305d221b57630e77595c9f2e2060e8d98911a6 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -173,6 +173,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -174,6 +174,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; diff --git a/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch b/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch index 8e05749599de..21044952aa92 100644 --- a/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch +++ b/patches/devtools_frontend/fix_expose_globals_to_allow_patching_devtools_dock.patch @@ -11,6 +11,18 @@ re-expose them to fix this broken functionality. We should look to upstream a more durable approach to allowing us to do this, at which point this patch can be removed. +diff --git a/config/gni/devtools_grd_files.gni b/config/gni/devtools_grd_files.gni +index 884afd2a45b4afb68b3b88124eecb4c674dad7c1..de3ed466805c5cf0badb1c98775f9c39c65aa421 100644 +--- a/config/gni/devtools_grd_files.gni ++++ b/config/gni/devtools_grd_files.gni +@@ -658,6 +658,7 @@ grd_files_release_sources = [ + "front_end/ui/legacy/components/source_frame/source_frame.js", + "front_end/ui/legacy/components/utils/utils-legacy.js", + "front_end/ui/legacy/components/utils/utils.js", ++ "front_end/ui/legacy/legacy-legacy.js", + "front_end/ui/legacy/legacy.js", + "front_end/ui/legacy/theme_support/theme_support.js", + "front_end/ui/legacy/utils/utils.js", diff --git a/front_end/entrypoints/shell/BUILD.gn b/front_end/entrypoints/shell/BUILD.gn index 9b7c4251dde44c7e2ce76637515bb193a63427d8..76c2f924967df85d01ed41616609273adfad1342 100644 --- a/front_end/entrypoints/shell/BUILD.gn @@ -36,13 +48,272 @@ index b1f0db6afb29188e4e69c5dd899523e836f9d253..4290e626fd875a50740bbd668ca11a4f import '../../ui/legacy/components/source_frame/source_frame-meta.js'; import '../../panels/console_counters/console_counters-meta.js'; diff --git a/front_end/ui/legacy/BUILD.gn b/front_end/ui/legacy/BUILD.gn -index e94af4d321de3dbd0eb1d0190f9e9339875be318..f4fc031e4ccb988731913f0b3603a3169c54a57f 100644 +index 2985b61e9b346709022202b3858a8138003b4439..f4fc031e4ccb988731913f0b3603a3169c54a57f 100644 --- a/front_end/ui/legacy/BUILD.gn +++ b/front_end/ui/legacy/BUILD.gn -@@ -188,5 +188,6 @@ devtools_entrypoint("legacy") { - visibility = [ - "../..:legacy_entrypoints", - "../../legacy_test_runner/*", -+ "../../entrypoints/shell/*", - ] +@@ -179,3 +179,15 @@ devtools_entrypoint("bundle") { + + visibility += devtools_ui_legacy_visibility } ++ ++devtools_entrypoint("legacy") { ++ entrypoint = "legacy-legacy.ts" ++ ++ deps = [ ":bundle" ] ++ ++ visibility = [ ++ "../..:legacy_entrypoints", ++ "../../legacy_test_runner/*", ++ "../../entrypoints/shell/*", ++ ] ++} +diff --git a/front_end/ui/legacy/legacy-legacy.ts b/front_end/ui/legacy/legacy-legacy.ts +new file mode 100644 +index 0000000000000000000000000000000000000000..9ca383ccdb044f22fe75c8f9326cb0c75ac3a19a +--- /dev/null ++++ b/front_end/ui/legacy/legacy-legacy.ts +@@ -0,0 +1,244 @@ ++// Copyright 2019 The Chromium Authors. All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++// @ts-nocheck ++ ++import * as UIModule from './legacy.js'; ++ ++self.UI = self.UI || {}; ++UI = UI || {}; ++ ++/** @constructor */ ++UI.DockController = UIModule.DockController.DockController; ++ ++/** @enum {symbol} */ ++UI.DockController.Events = UIModule.DockController.Events; ++ ++/** @constructor */ ++UI.DockController.ToggleDockActionDelegate = UIModule.DockController.ToggleDockActionDelegate; ++ ++/** @constructor */ ++UI.DockController.CloseButtonProvider = UIModule.DockController.CloseButtonProvider; ++ ++/** @constructor */ ++UI.Context = UIModule.Context.Context; ++ ++/** @interface */ ++UI.ContextFlavorListener = UIModule.ContextFlavorListener.ContextFlavorListener; ++ ++/** @constructor */ ++UI.ContextMenu = UIModule.ContextMenu.ContextMenu; ++ ++/** ++ * @interface ++ */ ++UI.ContextMenu.Provider = UIModule.ContextMenu.Provider; ++ ++/** @constructor */ ++UI.Dialog = UIModule.Dialog.Dialog; ++ ++/** @constructor */ ++UI.EmptyWidget = UIModule.EmptyWidget.EmptyWidget; ++ ++/** @constructor */ ++UI.Fragment = UIModule.Fragment.Fragment; ++ ++UI.html = UIModule.Fragment.html; ++ ++UI.Geometry = {}; ++ ++/** ++ * @constructor ++ */ ++UI.Geometry.Vector = UIModule.Geometry.Vector; ++ ++/** ++ * @constructor ++ */ ++UI.Geometry.CubicBezier = UIModule.Geometry.CubicBezier; ++ ++/** ++ * @constructor ++ */ ++UI.Geometry.EulerAngles = UIModule.Geometry.EulerAngles; ++ ++/** ++ * @param {!UIModule.Geometry.Vector} u ++ * @param {!UIModule.Geometry.Vector} v ++ * @return {number} ++ */ ++UI.Geometry.scalarProduct = UIModule.Geometry.scalarProduct; ++ ++/** ++ * @param {!UIModule.Geometry.Vector} u ++ * @param {!UIModule.Geometry.Vector} v ++ * @return {!UIModule.Geometry.Vector} ++ */ ++UI.Geometry.crossProduct = UIModule.Geometry.crossProduct; ++ ++/** ++ * @param {!UIModule.Geometry.Vector} u ++ * @param {!UIModule.Geometry.Vector} v ++ * @return {number} ++ */ ++UI.Geometry.calculateAngle = UIModule.Geometry.calculateAngle; ++ ++/** ++ * @param {number} deg ++ * @return {number} ++ */ ++UI.Geometry.degreesToRadians = UIModule.Geometry.degreesToRadians; ++ ++/** ++ * @param {number} rad ++ * @return {number} ++ */ ++UI.Geometry.radiansToDegrees = UIModule.Geometry.radiansToDegrees; ++ ++/** @constructor */ ++UI.Size = UIModule.Geometry.Size; ++ ++/** @constructor */ ++UI.GlassPane = UIModule.GlassPane.GlassPane; ++ ++// Exported for layout tests. ++UI.GlassPane._panes = UIModule.GlassPane.GlassPanePanes; ++ ++/** @constructor */ ++UI.InspectorView = UIModule.InspectorView.InspectorView; ++ ++/** ++ * @implements {UI.ActionDelegate} ++ */ ++UI.InspectorView.ActionDelegate = UIModule.InspectorView.ActionDelegate; ++ ++/** @constructor */ ++UI.ListControl = UIModule.ListControl.ListControl; ++ ++UI.ListMode = UIModule.ListControl.ListMode; ++ ++/** @constructor */ ++UI.ListModel = UIModule.ListModel.ListModel; ++ ++/** @constructor */ ++UI.Panel = UIModule.Panel.Panel; ++ ++// For testing. ++UI.panels = {}; ++ ++/** @constructor */ ++UI.SearchableView = UIModule.SearchableView.SearchableView; ++ ++/** ++ * @constructor ++ */ ++UI.SearchableView.SearchConfig = UIModule.SearchableView.SearchConfig; ++ ++/** @interface */ ++UI.Searchable = UIModule.SearchableView.Searchable; ++ ++/** ++ * @interface ++ */ ++UI.SettingUI = UIModule.SettingsUI.SettingUI; ++ ++/** @constructor */ ++UI.ShortcutRegistry = UIModule.ShortcutRegistry.ShortcutRegistry; ++ ++UI.ShortcutRegistry.ForwardedShortcut = UIModule.ShortcutRegistry.ForwardedShortcut; ++ ++/** @constructor */ ++UI.SoftContextMenu = UIModule.SoftContextMenu.SoftContextMenu; ++ ++/** @constructor */ ++UI.SoftDropDown = UIModule.SoftDropDown.SoftDropDown; ++ ++/** @constructor */ ++UI.SplitWidget = UIModule.SplitWidget.SplitWidget; ++ ++/** @constructor */ ++UI.SuggestBox = UIModule.SuggestBox.SuggestBox; ++ ++/** @constructor */ ++UI.TabbedPane = UIModule.TabbedPane.TabbedPane; ++ ++/** @enum {symbol} */ ++UI.TabbedPane.Events = UIModule.TabbedPane.Events; ++ ++/** @constructor */ ++UI.TextPrompt = UIModule.TextPrompt.TextPrompt; ++ ++/** @constructor */ ++UI.Toolbar = UIModule.Toolbar.Toolbar; ++ ++/** @constructor */ ++UI.ToolbarItem = UIModule.Toolbar.ToolbarItem; ++ ++/** @interface */ ++UI.ToolbarItem.Provider = UIModule.Toolbar.Provider; ++ ++/** @constructor */ ++UI.Tooltip = UIModule.Tooltip.Tooltip; ++ ++// Exported for layout tests. ++UI.Tooltip._symbol = UIModule.Tooltip.TooltipSymbol; ++ ++/** @constructor */ ++UI.TreeOutline = UIModule.TreeOutline.TreeOutline; ++ ++UI.TreeOutline.Events = UIModule.TreeOutline.Events; ++ ++/** @constructor */ ++UI.TreeElement = UIModule.TreeOutline.TreeElement; ++ ++/** @constructor */ ++UI.TreeOutlineInShadow = UIModule.TreeOutline.TreeOutlineInShadow; ++ ++/** @interface */ ++UI.Renderer = UIModule.UIUtils.Renderer; ++ ++UI.isBeingEdited = UIModule.UIUtils.isBeingEdited; ++UI.isEditing = UIModule.UIUtils.isEditing; ++UI.highlightRangesWithStyleClass = UIModule.UIUtils.highlightRangesWithStyleClass; ++UI.applyDomChanges = UIModule.UIUtils.applyDomChanges; ++UI.revertDomChanges = UIModule.UIUtils.revertDomChanges; ++UI.beautifyFunctionName = UIModule.UIUtils.beautifyFunctionName; ++ ++/** @interface */ ++UI.View = UIModule.View.View; ++ ++/** @constructor */ ++UI.SimpleView = UIModule.View.SimpleView; ++ ++/** @interface */ ++UI.ViewLocation = UIModule.View.ViewLocation; ++ ++/** @interface */ ++UI.ViewLocationResolver = UIModule.View.ViewLocationResolver; ++ ++/** @constructor */ ++UI.ViewManager = UIModule.ViewManager.ViewManager; ++ ++/** @constructor */ ++UI.ViewManager._ContainerWidget = UIModule.ViewManager.ContainerWidget; ++ ++/** @constructor */ ++UI.Widget = UIModule.Widget.Widget; ++ ++/** @constructor */ ++UI.XLink = UIModule.XLink.XLink; ++ ++/** ++ * @implements {UI.ContextMenu.Provider} ++ */ ++UI.XLink.ContextMenuProvider = UIModule.XLink.ContextMenuProvider; ++ ++/** @type {!UIModule.Context.Context} */ ++self.UI.context = UIModule.Context.Context.instance(); ++ ++/** ++ * @type {!UI.DockController} ++ */ ++UI.dockController; ++ diff --git a/shell/browser/notifications/linux/libnotify_notification.cc b/shell/browser/notifications/linux/libnotify_notification.cc index 82f7178078e9..0dcfad8aa6dd 100644 --- a/shell/browser/notifications/linux/libnotify_notification.cc +++ b/shell/browser/notifications/linux/libnotify_notification.cc @@ -8,6 +8,7 @@ #include #include "base/files/file_enumerator.h" +#include "base/functional/bind.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "shell/browser/notifications/notification_delegate.h" @@ -87,15 +88,16 @@ void LibnotifyNotification::Show(const NotificationOptions& options) { base::UTF16ToUTF8(options.title).c_str(), base::UTF16ToUTF8(options.msg).c_str(), nullptr); - g_signal_connect(notification_, "closed", - G_CALLBACK(OnNotificationClosedThunk), this); + signal_ = ScopedGSignal( + notification_, "closed", + base::BindRepeating(&LibnotifyNotification::OnNotificationClosed, + base::Unretained(this))); // NB: On Unity and on any other DE using Notify-OSD, adding a notification // action will cause the notification to display as a modal dialog box. if (NotifierSupportsActions()) { libnotify_loader_.notify_notification_add_action( - notification_, "default", "View", OnNotificationViewThunk, this, - nullptr); + notification_, "default", "View", OnNotificationView, this, nullptr); } NotifyUrgency urgency = NOTIFY_URGENCY_NORMAL; @@ -175,8 +177,11 @@ void LibnotifyNotification::OnNotificationClosed( } void LibnotifyNotification::OnNotificationView(NotifyNotification* notification, - char* action) { - NotificationClicked(); + char* action, + gpointer user_data) { + LibnotifyNotification* that = static_cast(user_data); + DCHECK(that); + that->NotificationClicked(); } } // namespace electron diff --git a/shell/browser/notifications/linux/libnotify_notification.h b/shell/browser/notifications/linux/libnotify_notification.h index 4e20ab4e129c..8aacd0952062 100644 --- a/shell/browser/notifications/linux/libnotify_notification.h +++ b/shell/browser/notifications/linux/libnotify_notification.h @@ -8,7 +8,7 @@ #include "base/memory/raw_ptr_exclusion.h" #include "library_loaders/libnotify_loader.h" #include "shell/browser/notifications/notification.h" -#include "ui/base/glib/glib_signal.h" +#include "ui/base/glib/scoped_gsignal.h" namespace electron { @@ -25,17 +25,14 @@ class LibnotifyNotification : public Notification { void Dismiss() override; private: - CHROMEG_CALLBACK_0(LibnotifyNotification, - void, - OnNotificationClosed, - NotifyNotification*); - CHROMEG_CALLBACK_1(LibnotifyNotification, - void, - OnNotificationView, - NotifyNotification*, - char*); + void OnNotificationClosed(NotifyNotification* notification); + static void OnNotificationView(NotifyNotification* notification, + char* action, + gpointer user_data); RAW_PTR_EXCLUSION NotifyNotification* notification_ = nullptr; + + ScopedGSignal signal_; }; } // namespace electron diff --git a/shell/browser/ui/file_dialog_gtk.cc b/shell/browser/ui/file_dialog_gtk.cc index f76194721cdc..c8a81553c4c2 100644 --- a/shell/browser/ui/file_dialog_gtk.cc +++ b/shell/browser/ui/file_dialog_gtk.cc @@ -6,6 +6,7 @@ #include #include "base/files/file_util.h" +#include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr_exclusion.h" @@ -17,7 +18,7 @@ #include "shell/browser/ui/gtk_util.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/thread_restrictions.h" -#include "ui/base/glib/glib_signal.h" +#include "ui/base/glib/scoped_gsignal.h" #include "ui/gtk/gtk_ui.h" // nogncheck #include "ui/gtk/gtk_util.h" // nogncheck @@ -121,8 +122,10 @@ class FileChooserDialog { // the update-preview signal or the preview widget will just be ignored. if (!electron::IsElectron_gtkInitialized()) { preview_ = gtk_image_new(); - g_signal_connect(dialog_, "update-preview", - G_CALLBACK(OnUpdatePreviewThunk), this); + signals_.emplace_back( + dialog_, "update-preview", + base::BindRepeating(&FileChooserDialog::OnUpdatePreview, + base::Unretained(this))); gtk_file_chooser_set_preview_widget(dialog_, preview_); } } @@ -165,8 +168,10 @@ class FileChooserDialog { } void RunAsynchronous() { - g_signal_connect(dialog_, "response", G_CALLBACK(OnFileDialogResponseThunk), - this); + signals_.emplace_back( + GTK_WIDGET(dialog_), "response", + base::BindRepeating(&FileChooserDialog::OnFileDialogResponse, + base::Unretained(this))); if (electron::IsElectron_gtkInitialized()) { gtk_native_dialog_show(GTK_NATIVE_DIALOG(dialog_)); } else { @@ -210,11 +215,7 @@ class FileChooserDialog { return paths; } - CHROMEG_CALLBACK_1(FileChooserDialog, - void, - OnFileDialogResponse, - GtkWidget*, - int); + void OnFileDialogResponse(GtkWidget* widget, int response); GtkFileChooser* dialog() const { return dialog_; } @@ -231,7 +232,9 @@ class FileChooserDialog { std::unique_ptr> open_promise_; // Callback for when we update the preview for the selection. - CHROMEG_CALLBACK_0(FileChooserDialog, void, OnUpdatePreview, GtkFileChooser*); + void OnUpdatePreview(GtkFileChooser* chooser); + + std::vector signals_; }; void FileChooserDialog::OnFileDialogResponse(GtkWidget* widget, int response) { diff --git a/shell/browser/ui/gtk/menu_gtk.cc b/shell/browser/ui/gtk/menu_gtk.cc index 77843d41c82c..5ba2847cf915 100644 --- a/shell/browser/ui/gtk/menu_gtk.cc +++ b/shell/browser/ui/gtk/menu_gtk.cc @@ -6,6 +6,7 @@ #include +#include "base/functional/bind.h" #include "shell/browser/ui/gtk/menu_util.h" #include "ui/base/models/menu_model.h" @@ -15,8 +16,9 @@ MenuGtk::MenuGtk(ui::MenuModel* model) : menu_model_(model), gtk_menu_(TakeGObject(gtk_menu_new())) { if (menu_model_) { BuildSubmenuFromModel(menu_model_, gtk_menu_, - G_CALLBACK(OnMenuItemActivatedThunk), - &block_activation_, this); + base::BindRepeating(&MenuGtk::OnMenuItemActivated, + base::Unretained(this)), + &block_activation_, &signals_); Refresh(); } } diff --git a/shell/browser/ui/gtk/menu_gtk.h b/shell/browser/ui/gtk/menu_gtk.h index 8faca14f6429..4ea65b7b452e 100644 --- a/shell/browser/ui/gtk/menu_gtk.h +++ b/shell/browser/ui/gtk/menu_gtk.h @@ -7,8 +7,8 @@ #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" -#include "ui/base/glib/glib_signal.h" #include "ui/base/glib/scoped_gobject.h" +#include "ui/base/glib/scoped_gsignal.h" typedef struct _GtkMenu GtkMenu; typedef struct _GtkWidget GtkWidget; @@ -31,12 +31,13 @@ class MenuGtk { private: // Callback for when a menu item is activated. - CHROMEG_CALLBACK_0(MenuGtk, void, OnMenuItemActivated, GtkWidget*); + void OnMenuItemActivated(GtkWidget* menu_item); raw_ptr menu_model_; // not owned ScopedGObject gtk_menu_; bool block_activation_ = false; + std::vector signals_; }; } // namespace electron::gtkui diff --git a/shell/browser/ui/gtk/menu_util.cc b/shell/browser/ui/gtk/menu_util.cc index 08f16d2e754e..7a4640e749d6 100644 --- a/shell/browser/ui/gtk/menu_util.cc +++ b/shell/browser/ui/gtk/menu_util.cc @@ -109,8 +109,8 @@ GtkWidget* AppendMenuItemToMenu(int index, GtkWidget* menu_item, GtkWidget* menu, bool connect_to_activate, - GCallback item_activated_cb, - void* this_ptr) { + MenuActivatedCallback item_activated_cb, + std::vector* signals) { // Set the ID of a menu item. // Add 1 to the menu_id to avoid setting zero (null) to "menu-id". g_object_set_data(G_OBJECT(menu_item), "menu-id", GINT_TO_POINTER(index + 1)); @@ -118,7 +118,7 @@ GtkWidget* AppendMenuItemToMenu(int index, // Native menu items do their own thing, so only selectively listen for the // activate signal. if (connect_to_activate) { - g_signal_connect(menu_item, "activate", item_activated_cb, this_ptr); + signals->emplace_back(menu_item, "activate", item_activated_cb); } // AppendMenuItemToMenu is used both internally when we control menu creation @@ -158,9 +158,9 @@ void ExecuteCommand(ui::MenuModel* model, int id) { void BuildSubmenuFromModel(ui::MenuModel* model, GtkWidget* menu, - GCallback item_activated_cb, + MenuActivatedCallback item_activated_cb, bool* block_activation, - void* this_ptr) { + std::vector* signals) { std::map radio_groups; GtkWidget* menu_item = nullptr; for (size_t i = 0; i < model->GetItemCount(); ++i) { @@ -221,7 +221,7 @@ void BuildSubmenuFromModel(ui::MenuModel* model, GtkWidget* submenu = gtk_menu_new(); ui::MenuModel* submenu_model = model->GetSubmenuModelAt(i); BuildSubmenuFromModel(submenu_model, submenu, item_activated_cb, - block_activation, this_ptr); + block_activation, signals); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), submenu); // Update all the menu item info in the newly-generated menu. @@ -247,7 +247,7 @@ void BuildSubmenuFromModel(ui::MenuModel* model, g_object_set_data(G_OBJECT(menu_item), "model", model); AppendMenuItemToMenu(i, model, menu_item, menu, connect_to_activate, - item_activated_cb, this_ptr); + item_activated_cb, signals); menu_item = nullptr; } diff --git a/shell/browser/ui/gtk/menu_util.h b/shell/browser/ui/gtk/menu_util.h index ee4042eea453..2b7116d2689d 100644 --- a/shell/browser/ui/gtk/menu_util.h +++ b/shell/browser/ui/gtk/menu_util.h @@ -9,6 +9,8 @@ #include +#include "base/functional/callback.h" +#include "ui/base/glib/scoped_gsignal.h" #include "ui/gfx/image/image.h" namespace ui { @@ -17,6 +19,8 @@ class MenuModel; namespace electron::gtkui { +using MenuActivatedCallback = base::RepeatingCallback; + // Builds GtkImageMenuItems. GtkWidget* BuildMenuItemWithImage(const std::string& label, GtkWidget* image); GtkWidget* BuildMenuItemWithImage(const std::string& label, @@ -32,8 +36,8 @@ GtkWidget* AppendMenuItemToMenu(int index, GtkWidget* menu_item, GtkWidget* menu, bool connect_to_activate, - GCallback item_activated_cb, - void* this_ptr); + MenuActivatedCallback item_activated_cb, + std::vector* signals); // Gets the ID of a menu item. // Returns true if the menu item has an ID. @@ -47,9 +51,9 @@ void ExecuteCommand(ui::MenuModel* model, int id); // See comments in definition of SetMenuItemInfo for more info. void BuildSubmenuFromModel(ui::MenuModel* model, GtkWidget* menu, - GCallback item_activated_cb, + MenuActivatedCallback item_activated_cb, bool* block_activation, - void* this_ptr); + std::vector* signals); // Sets the check mark, enabled/disabled state and dynamic labels on menu items. void SetMenuItemInfo(GtkWidget* widget, void* block_activation_ptr); diff --git a/shell/browser/ui/message_box_gtk.cc b/shell/browser/ui/message_box_gtk.cc index 4b8e44029fc3..5b35b65c4868 100644 --- a/shell/browser/ui/message_box_gtk.cc +++ b/shell/browser/ui/message_box_gtk.cc @@ -7,6 +7,7 @@ #include #include "base/containers/contains.h" +#include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/memory/raw_ptr_exclusion.h" @@ -18,7 +19,7 @@ #include "shell/browser/native_window_observer.h" #include "shell/browser/native_window_views.h" #include "shell/browser/ui/gtk_util.h" -#include "ui/base/glib/glib_signal.h" +#include "ui/base/glib/scoped_gsignal.h" #include "ui/gfx/image/image_skia.h" #include "ui/gtk/gtk_ui.h" // nogncheck #include "ui/gtk/gtk_util.h" // nogncheck @@ -89,8 +90,10 @@ class GtkMessageBox : public NativeWindowObserver { gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dialog_)); GtkWidget* check_button = gtk_check_button_new_with_label(settings.checkbox_label.c_str()); - g_signal_connect(check_button, "toggled", - G_CALLBACK(OnCheckboxToggledThunk), this); + signals_.emplace_back( + check_button, "toggled", + base::BindRepeating(&GtkMessageBox::OnCheckboxToggled, + base::Unretained(this))); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), settings.checkbox_checked); gtk_container_add(GTK_CONTAINER(message_area), check_button); @@ -172,10 +175,11 @@ class GtkMessageBox : public NativeWindowObserver { void RunAsynchronous(MessageBoxCallback callback) { callback_ = std::move(callback); - g_signal_connect(dialog_, "delete-event", - G_CALLBACK(gtk_widget_hide_on_delete), nullptr); - g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseDialogThunk), - this); + signals_.emplace_back(dialog_, "delete-event", + base::BindRepeating(gtk_widget_hide_on_delete)); + signals_.emplace_back(dialog_, "response", + base::BindRepeating(&GtkMessageBox::OnResponseDialog, + base::Unretained(this))); Show(); } @@ -184,8 +188,8 @@ class GtkMessageBox : public NativeWindowObserver { parent_ = nullptr; } - CHROMEG_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, GtkWidget*, int); - CHROMEG_CALLBACK_0(GtkMessageBox, void, OnCheckboxToggled, GtkWidget*); + void OnResponseDialog(GtkWidget* widget, int response); + void OnCheckboxToggled(GtkWidget* widget); private: // The id of the dialog. @@ -199,6 +203,7 @@ class GtkMessageBox : public NativeWindowObserver { raw_ptr parent_; RAW_PTR_EXCLUSION GtkWidget* dialog_; MessageBoxCallback callback_; + std::vector signals_; }; void GtkMessageBox::OnResponseDialog(GtkWidget* widget, int response) { diff --git a/shell/browser/ui/status_icon_gtk.cc b/shell/browser/ui/status_icon_gtk.cc index 1c8d0024c92e..b70d8f3140ee 100644 --- a/shell/browser/ui/status_icon_gtk.cc +++ b/shell/browser/ui/status_icon_gtk.cc @@ -7,6 +7,7 @@ #include +#include "base/functional/bind.h" #include "base/strings/utf_string_conversions.h" #include "shell/browser/ui/gtk/menu_gtk.h" #include "shell/browser/ui/gtk_util.h" @@ -15,9 +16,15 @@ namespace electron { StatusIconGtk::StatusIconGtk() : icon_(TakeGObject(gtk_status_icon_new())) { - g_signal_connect(icon_, "activate", G_CALLBACK(OnClickThunk), this); - g_signal_connect(icon_, "popup_menu", G_CALLBACK(OnContextMenuRequestedThunk), - this); + auto connect = [&](auto* sender, const char* detailed_signal, auto receiver) { + // Unretained() is safe since StatusIconGtk will own the + // ScopedGSignal. + signals_.emplace_back( + sender, detailed_signal, + base::BindRepeating(receiver, base::Unretained(this))); + }; + connect(icon_.get(), "activate", &StatusIconGtk::OnClick); + connect(icon_.get(), "popup_menu", &StatusIconGtk::OnContextMenuRequested); } StatusIconGtk::~StatusIconGtk() = default; diff --git a/shell/browser/ui/status_icon_gtk.h b/shell/browser/ui/status_icon_gtk.h index beeff7593043..f2444af007b5 100644 --- a/shell/browser/ui/status_icon_gtk.h +++ b/shell/browser/ui/status_icon_gtk.h @@ -8,8 +8,8 @@ #include #include "ui/base/glib/glib_integers.h" -#include "ui/base/glib/glib_signal.h" #include "ui/base/glib/scoped_gobject.h" +#include "ui/base/glib/scoped_gsignal.h" #include "ui/linux/status_icon_linux.h" typedef struct _GtkStatusIcon GtkStatusIcon; @@ -35,16 +35,14 @@ class StatusIconGtk : public ui::StatusIconLinux { void OnSetDelegate() override; private: - CHROMEG_CALLBACK_0(StatusIconGtk, void, OnClick, GtkStatusIcon*); - CHROMEG_CALLBACK_2(StatusIconGtk, - void, - OnContextMenuRequested, - GtkStatusIcon*, - guint, - guint); + void OnClick(GtkStatusIcon* status_icon); + void OnContextMenuRequested(GtkStatusIcon* status_icon, + guint button, + guint32 activate_time); std::unique_ptr menu_; ScopedGObject icon_; + std::vector signals_; }; } // namespace electron diff --git a/shell/browser/ui/views/global_menu_bar_registrar_x11.cc b/shell/browser/ui/views/global_menu_bar_registrar_x11.cc index 43af2c783a1e..df3428b34b0d 100644 --- a/shell/browser/ui/views/global_menu_bar_registrar_x11.cc +++ b/shell/browser/ui/views/global_menu_bar_registrar_x11.cc @@ -52,14 +52,11 @@ GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11() { nullptr, kAppMenuRegistrarName, kAppMenuRegistrarPath, kAppMenuRegistrarName, nullptr, // Probably want a real cancelable. - static_cast(OnProxyCreatedThunk), this); + static_cast(OnProxyCreated), this); } GlobalMenuBarRegistrarX11::~GlobalMenuBarRegistrarX11() { if (registrar_proxy_) { - g_signal_handlers_disconnect_by_func( - registrar_proxy_, reinterpret_cast(OnNameOwnerChangedThunk), - this); g_object_unref(registrar_proxy_); } } @@ -99,7 +96,12 @@ void GlobalMenuBarRegistrarX11::UnregisterXWindow(x11::Window window) { } void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source, - GAsyncResult* result) { + GAsyncResult* result, + gpointer user_data) { + GlobalMenuBarRegistrarX11* that = + static_cast(user_data); + DCHECK(that); + GError* error = nullptr; GDBusProxy* proxy = g_dbus_proxy_new_for_bus_finish(result, &error); if (error) { @@ -110,16 +112,21 @@ void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source, // TODO(erg): Mozilla's implementation has a workaround for GDBus // cancellation here. However, it's marked as fixed. If there's weird // problems with cancelation, look at how they fixed their issues. + that->SetRegistrarProxy(proxy); - registrar_proxy_ = proxy; - - g_signal_connect(registrar_proxy_, "notify::g-name-owner", - G_CALLBACK(OnNameOwnerChangedThunk), this); - - OnNameOwnerChanged(nullptr, nullptr); + that->OnNameOwnerChanged(nullptr, nullptr); } -void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GObject* /* ignored */, +void GlobalMenuBarRegistrarX11::SetRegistrarProxy(GDBusProxy* proxy) { + registrar_proxy_ = proxy; + + signal_ = ScopedGSignal( + registrar_proxy_, "notify::g-name-owner", + base::BindRepeating(&GlobalMenuBarRegistrarX11::OnNameOwnerChanged, + base::Unretained(this))); +} + +void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GDBusProxy* /* ignored */, GParamSpec* /* ignored */) { // If the name owner changed, we need to reregister all the live x11::Window // with the system. diff --git a/shell/browser/ui/views/global_menu_bar_registrar_x11.h b/shell/browser/ui/views/global_menu_bar_registrar_x11.h index 930d8c44730c..71e2a9fd6084 100644 --- a/shell/browser/ui/views/global_menu_bar_registrar_x11.h +++ b/shell/browser/ui/views/global_menu_bar_registrar_x11.h @@ -12,7 +12,7 @@ #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" -#include "ui/base/glib/glib_signal.h" +#include "ui/base/glib/scoped_gsignal.h" #include "ui/gfx/x/xproto.h" // Advertises our menu bars to Unity. @@ -43,22 +43,18 @@ class GlobalMenuBarRegistrarX11 { void RegisterXWindow(x11::Window window); void UnregisterXWindow(x11::Window window); - CHROMEG_CALLBACK_1(GlobalMenuBarRegistrarX11, - void, - OnProxyCreated, - GObject*, - GAsyncResult*); - CHROMEG_CALLBACK_1(GlobalMenuBarRegistrarX11, - void, - OnNameOwnerChanged, - GObject*, - GParamSpec*); + static void OnProxyCreated(GObject* source, + GAsyncResult* result, + gpointer user_data); + void OnNameOwnerChanged(GDBusProxy* /* ignored */, GParamSpec* /* ignored */); + void SetRegistrarProxy(GDBusProxy* proxy); raw_ptr registrar_proxy_ = nullptr; // x11::Window which want to be registered, but haven't yet been because // we're waiting for the proxy to become available. std::set live_windows_; + ScopedGSignal signal_; }; #endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_GLOBAL_MENU_BAR_REGISTRAR_X11_H_ diff --git a/shell/browser/ui/views/global_menu_bar_x11.cc b/shell/browser/ui/views/global_menu_bar_x11.cc index d7ea6713633f..78ec7cd6ff19 100644 --- a/shell/browser/ui/views/global_menu_bar_x11.cc +++ b/shell/browser/ui/views/global_menu_bar_x11.cc @@ -7,6 +7,7 @@ #include #include +#include "base/functional/bind.h" #include "base/logging.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -232,6 +233,13 @@ void GlobalMenuBarX11::OnWindowUnmapped() { void GlobalMenuBarX11::BuildMenuFromModel(ElectronMenuModel* model, DbusmenuMenuitem* parent) { + auto connect = [&](auto* sender, const char* detailed_signal, auto receiver) { + // Unretained() is safe since GlobalMenuBarX11 will own the + // ScopedGSignal. + signals_.emplace_back( + sender, detailed_signal, + base::BindRepeating(receiver, base::Unretained(this))); + }; for (size_t i = 0; i < model->GetItemCount(); ++i) { DbusmenuMenuitem* item = menuitem_new(); menuitem_property_set_bool(item, kPropertyVisible, model->IsVisibleAt(i)); @@ -250,15 +258,13 @@ void GlobalMenuBarX11::BuildMenuFromModel(ElectronMenuModel* model, if (type == ElectronMenuModel::TYPE_SUBMENU) { menuitem_property_set(item, kPropertyChildrenDisplay, kDisplaySubmenu); - g_signal_connect(item, "about-to-show", G_CALLBACK(OnSubMenuShowThunk), - this); + connect(item, "about-to-show", &GlobalMenuBarX11::OnSubMenuShow); } else { ui::Accelerator accelerator; if (model->GetAcceleratorAtWithParams(i, true, &accelerator)) RegisterAccelerator(item, accelerator); - g_signal_connect(item, "item-activated", - G_CALLBACK(OnItemActivatedThunk), this); + connect(item, "item-activated", &GlobalMenuBarX11::OnItemActivated); if (type == ElectronMenuModel::TYPE_CHECK || type == ElectronMenuModel::TYPE_RADIO) { diff --git a/shell/browser/ui/views/global_menu_bar_x11.h b/shell/browser/ui/views/global_menu_bar_x11.h index dbffbf7e64e8..31bca417f275 100644 --- a/shell/browser/ui/views/global_menu_bar_x11.h +++ b/shell/browser/ui/views/global_menu_bar_x11.h @@ -10,7 +10,7 @@ #include "base/compiler_specific.h" #include "base/memory/raw_ptr.h" #include "shell/browser/ui/electron_menu_model.h" -#include "ui/base/glib/glib_signal.h" +#include "ui/base/glib/scoped_gsignal.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/x/xproto.h" @@ -66,17 +66,14 @@ class GlobalMenuBarX11 { void RegisterAccelerator(DbusmenuMenuitem* item, const ui::Accelerator& accelerator); - CHROMEG_CALLBACK_1(GlobalMenuBarX11, - void, - OnItemActivated, - DbusmenuMenuitem*, - unsigned int); - CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnSubMenuShow, DbusmenuMenuitem*); + void OnItemActivated(DbusmenuMenuitem* item, unsigned int timestamp); + void OnSubMenuShow(DbusmenuMenuitem* item); raw_ptr window_; x11::Window xwindow_; raw_ptr server_ = nullptr; + std::vector signals_; }; } // namespace electron