mirror of
https://github.com/electron/electron.git
synced 2026-01-07 22:54:25 -05:00
* chore: bump chromium in DEPS to 139.0.7205.0 * 6543986: Mac: decouple deserializing and applying sandbox policy Refs https://chromium-review.googlesource.com/c/chromium/src/+/6543986 * 6580079: Reland 'Remove the third-party blocking feature' Refs https://chromium-review.googlesource.com/c/chromium/src/+/6580079 * 6505716: guest-contents: Add components/guest_contents Refs https://chromium-review.googlesource.com/c/chromium/src/+/6505716 * 6572556: Move LogMessageManager out of gpu_service_impl.cc. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6572556 * 6566111: Change UtilityProcessHost to manage its instance internally Refs https://chromium-review.googlesource.com/c/chromium/src/+/6566111 * 6550237: Rename ReconnectEventObserver to ConnectionChangeObserverClient Refs https://chromium-review.googlesource.com/c/chromium/src/+/6550237 * 6565918: Validate path is valid UTF8 in SelectFileDialogLinuxPortal Refs https://chromium-review.googlesource.com/c/chromium/src/+/6565918 * 6579713: Remove base::NotFatalUntil::M130 usage 6566111: Change UtilityProcessHost to manage its instance internally Refs https://chromium-review.googlesource.com/c/chromium/src/+/6579713 https://chromium-review.googlesource.com/c/chromium/src/+/6566111 * chore: update chromium patches * chore: update remaining patches * fixup! 6566111: Change UtilityProcessHost to manage its instance internally Refs https://chromium-review.googlesource.com/c/chromium/src/+/6566111 * 6577970: Remove superfluous includes for base/strings/stringprintf.h in headers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6577970 * 6568811: Add FunctionCall structured metrics event for DevTools Refs https://chromium-review.googlesource.com/c/chromium/src/+/6568811 * [PDF Ink Signatures] Support PdfAnnotationsEnabled policy https://chromium-review.googlesource.com/c/chromium/src/+/6558970 * build: disable libcxx modules for rbe * chore: bump chromium in DEPS to 139.0.7217.0 * chore: bump chromium in DEPS to 139.0.7218.0 * chore: update patches fix_use_delegated_generic_capturer_when_available.patch was updated to handle a small change: 6582142: Use content::Create*Capturer in DesktopCaptureDevice. | https://chromium-review.googlesource.com/c/chromium/src/+/6582142 * chore: bump chromium in DEPS to 139.0.7219.0 * chore: update patches * 6594615: Change Chromium's deployment target to macOS 12 https://chromium-review.googlesource.com/c/chromium/src/+/6594615 Updated the assertion message to match the docs structure now too. I removed the callout to the supported versions doc because it has moved and doesn't contain minimum platform version information. * 6606232: [views] Remove DesktopWindowTreeHostWin::window_enlargement_ https://chromium-review.googlesource.com/c/chromium/src/+/6606232 |NativeWindow::GetContentMinimumSize| and |NativeWindow::GetContentMaximumSize| may be good opportunities for a refactor now. * add squirrel.mac patch for removed function This was triggered by the macOS 12.0 deployment upgrade change. See: https://developer.apple.com/documentation/coreservices/1444079-uttypeconformsto?language=objc * 6582142: Use content::Create*Capturer in DesktopCaptureDevice. https://chromium-review.googlesource.com/c/chromium/src/+/6582142 * 6579732: Two minor API "quality of life" cleanups in OSCrypt Async https://chromium-review.googlesource.com/c/chromium/src/+/6579732 * chore: add include for base::SingleThreadTaskRunner Not sure what change caused this, I expect it would be a removed include somewhere else, but it's likely not important to track down. * chore: update libcxx filenames * chore: update CI build-tools commit target for macOS SDK 15.4 The following change uses an API that was added in the macOS 15.4 SDK. Support for that SDK version was added later than the current build-tools commit target. 6575804: Use a quick-and-dirty solution to avoid glitching with paste-and-go | https://chromium-review.googlesource.com/c/chromium/src/+/6575804 See: https://developer.apple.com/documentation/appkit/nspasteboard/accessbehavior-swift.enum?language=objc * fixup! 6606232: [views] Remove DesktopWindowTreeHostWin::window_enlargement_ https://chromium-review.googlesource.com/c/chromium/src/+/6606232 * chore: bump chromium in DEPS to 139.0.7220.0 * chore: update patches Minor changes due to: 6613978: pwa: let events fall through in the transparent area of TopContainerView | https://chromium-review.googlesource.com/c/chromium/src/+/6613978 6614778: Refactor auto pip tab observer for Android support | https://chromium-review.googlesource.com/c/chromium/src/+/6614778 * 6543986: Mac: decouple deserializing and applying sandbox policy https://chromium-review.googlesource.com/c/chromium/src/+/6543986 The DecodeVarInt and DecodeString functions look benign from a MAS perspective. I suspect they were patched out to avoid "unused function" errors. Their complements for encoding are unpatched, supporting this idea. The code that uses these functions was refactored out of the section that we patch out. Instead of patching out that new function, I decided to treat it the same as the serialization function that is unpatched. * chore: bump chromium in DEPS to 139.0.7222.0 * chore: bump chromium in DEPS to 139.0.7224.0 * chore: bump chromium in DEPS to 139.0.7226.0 * chore: bump chromium in DEPS to 139.0.7228.0 * chore: update patches * Don't use static variable for UseExternalPopupMenus https://chromium-review.googlesource.com/c/chromium/src/+/6534657 * Reland "Roll libc++ from a01c02c9d4ac to a9cc573e7c59 https://chromium-review.googlesource.com/c/chromium/src/+/6607589 * chore: bump chromium in DEPS to 139.0.7219.0 * chore: update patches * revert Don't use static variable for UseExternalPopupMenus * tls: remove deprecated tls.createSecurePair and SecurePair https://github.com/nodejs/node/pull/57361 * Revert "Reland "Roll libc++ from a01c02c9d4ac to a9cc573e7c59" This reverts commit33e1436a0c. * test: cleanup api-desktop-capturer-spec.ts * test: more cleanup of api-desktop-capturer-spec.ts * chore: debug dcheck error in webrtc on linux * fixup patch * add debugging to desktop capturer spec * test: fixup api-desktop-capturer-spec.ts for linux * chore: remove debugging patch * Revert "fixup! 6606232: [views] Remove DesktopWindowTreeHostWin::window_enlargement_ https://chromium-review.googlesource.com/c/chromium/src/+/6606232" This reverts commit32e75651c1. * Revert "6606232: [views] Remove DesktopWindowTreeHostWin::window_enlargement_" This reverts commit89c51aa1c7. * [views] Remove DesktopWindowTreeHostWin::window_enlargement_ https://chromium-review.googlesource.com/c/chromium/src/+/6606232 Reverting as we need this functionality for now. * fixup: remove patch that was accidentally added back --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
100 lines
4.5 KiB
Diff
100 lines
4.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
Date: Mon, 16 Aug 2021 17:55:32 +0200
|
|
Subject: fix: media key usage with globalShortcuts
|
|
|
|
This patch enables media keys to work properly with Electron's globalShortcut
|
|
module. Chromium's default usage of RemoteCommandCenterDelegate on macOS falls
|
|
down into MPRemoteCommandCenter, which makes it such that an app will not
|
|
receive remote control events until it begins playing audio. This runs
|
|
counter to the design of globalShortcuts, and so we need to instead
|
|
use `ui::MediaKeysListener`.
|
|
|
|
diff --git a/content/browser/media/media_keys_listener_manager_impl.cc b/content/browser/media/media_keys_listener_manager_impl.cc
|
|
index 42e37564e585987d367921568f0f1d2b7507f953..9baf89efbade01e8b60c579255f10799914e144f 100644
|
|
--- a/content/browser/media/media_keys_listener_manager_impl.cc
|
|
+++ b/content/browser/media/media_keys_listener_manager_impl.cc
|
|
@@ -87,7 +87,11 @@ bool MediaKeysListenerManagerImpl::StartWatchingMediaKey(
|
|
CanActiveMediaSessionControllerReceiveEvents();
|
|
|
|
// Tell the underlying MediaKeysListener to listen for the key.
|
|
- if (should_start_watching && media_keys_listener_ &&
|
|
+ if (
|
|
+#if BUILDFLAG(IS_MAC)
|
|
+ !media_key_handling_enabled_ &&
|
|
+#endif // BUILDFLAG(IS_MAC)
|
|
+ should_start_watching && media_keys_listener_ &&
|
|
!media_keys_listener_->StartWatchingMediaKey(key_code)) {
|
|
return false;
|
|
}
|
|
@@ -361,6 +365,20 @@ void MediaKeysListenerManagerImpl::StartListeningForMediaKeysIfNecessary() {
|
|
this, ui::MediaKeysListener::Scope::kGlobal);
|
|
DCHECK(media_keys_listener_);
|
|
}
|
|
+
|
|
+#if BUILDFLAG(IS_MAC)
|
|
+ // Chromium's implementation of SystemMediaControls falls
|
|
+ // down into MPRemoteCommandCenter, which makes it such that an app will not
|
|
+ // will not receive remote control events until it begins playing audio.
|
|
+ // If there's not already a MediaKeysListener instance, create one so
|
|
+ // that globalShortcuts work correctly.
|
|
+ if (!media_keys_listener_) {
|
|
+ media_keys_listener_ = ui::MediaKeysListener::Create(
|
|
+ this, ui::MediaKeysListener::Scope::kGlobal);
|
|
+ DCHECK(media_keys_listener_);
|
|
+ }
|
|
+#endif
|
|
+
|
|
EnsureAuxiliaryServices();
|
|
}
|
|
|
|
diff --git a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc
|
|
index 16b11c6115cc5504dbd15d58c4b9786633e90e96..7c0a2308d437a2d9cec433c6ab0fd6a9d0c08845 100644
|
|
--- a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc
|
|
+++ b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.cc
|
|
@@ -64,6 +64,22 @@ void GlobalAcceleratorListener::UnregisterAccelerator(
|
|
}
|
|
}
|
|
|
|
+// static
|
|
+void GlobalAcceleratorListener::SetShouldUseInternalMediaKeyHandling(bool should_use) {
|
|
+ if (content::MediaKeysListenerManager::
|
|
+ IsMediaKeysListenerManagerEnabled()) {
|
|
+ content::MediaKeysListenerManager* media_keys_listener_manager =
|
|
+ content::MediaKeysListenerManager::GetInstance();
|
|
+ DCHECK(media_keys_listener_manager);
|
|
+
|
|
+ if (should_use) {
|
|
+ media_keys_listener_manager->EnableInternalMediaKeyHandling();
|
|
+ } else {
|
|
+ media_keys_listener_manager->DisableInternalMediaKeyHandling();
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
void GlobalAcceleratorListener::UnregisterAccelerators(Observer* observer) {
|
|
if (IsShortcutHandlingSuspended()) {
|
|
return;
|
|
diff --git a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h
|
|
index 701808699796b0ef1a87d4d12f79fb6cf580c617..bf6e38410cedd6dd6d339b6f2f456124770bbd96 100644
|
|
--- a/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h
|
|
+++ b/ui/base/accelerators/global_accelerator_listener/global_accelerator_listener.h
|
|
@@ -8,6 +8,7 @@
|
|
#include <map>
|
|
|
|
#include "base/memory/raw_ptr.h"
|
|
+#include "content/public/browser/media_keys_listener_manager.h"
|
|
#include "ui/base/accelerators/command.h"
|
|
|
|
namespace ui {
|
|
@@ -38,6 +39,9 @@ class GlobalAcceleratorListener {
|
|
// The instance may be nullptr.
|
|
static GlobalAcceleratorListener* GetInstance();
|
|
|
|
+ // enables media keys to work with Electron's globalShortcut module.
|
|
+ static void SetShouldUseInternalMediaKeyHandling(bool should_use);
|
|
+
|
|
// Register an observer for when a certain `accelerator` is struck. Returns
|
|
// true if register successfully, or false if the specified `accelerator`
|
|
// has been registered by another caller or other native applications.
|