2023-11-21 10:53:21 -08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Samuel Attard <samuel.r.attard@gmail.com>
|
|
|
|
|
Date: Thu, 20 Sep 2018 17:48:49 -0700
|
|
|
|
|
Subject: mas: avoid private macOS API usage
|
|
|
|
|
|
|
|
|
|
* Use the stub killring file when building blink
|
|
|
|
|
* Remove usage of the following private APIs
|
|
|
|
|
* abort_report_np
|
|
|
|
|
* pthread_fchdir_np
|
|
|
|
|
* pthread_chdir_np
|
|
|
|
|
* SetApplicationIsDaemon
|
|
|
|
|
* _LSSetApplicationLaunchServicesServerConnectionStatus
|
|
|
|
|
* AreDeviceAndUserJoinedToDomain
|
|
|
|
|
* _CFIsObjC
|
|
|
|
|
* AudioDeviceDuck
|
|
|
|
|
* NSNextStepFrame
|
|
|
|
|
* NSThemeFrame
|
|
|
|
|
* NSTextInputReplacementRangeAttributeName
|
|
|
|
|
* NSAccessibilityRemoteUIElement is unnecessary for Electron's use-case. We use it
|
|
|
|
|
for progressive web apps (where the AXTree is in the browser process, but macOS
|
|
|
|
|
needs to think it's coming from the PWA process). I think it can just be chopped
|
|
|
|
|
out -- if there are any side-effects, we should be able to work around them.
|
|
|
|
|
* CAContext removal
|
|
|
|
|
* For apps that spend a lot of time watching video (especially fullscreen video),
|
|
|
|
|
the power/battery usage will likely increase 1.5x to 2x. For something that is,
|
|
|
|
|
e.g, scrolling, it'll be smaller, more like 1.15x or 1.25x.
|
|
|
|
|
|
|
|
|
|
In terms of performance, the impact will likely be fairly small -- any app that
|
|
|
|
|
could hit 60fps before will likely still be able to hit 60fps. There may even be
|
|
|
|
|
cases where performance improves when disabling remote CoreAnimation (remote
|
|
|
|
|
CoreAnimation is really only about battery usage).
|
|
|
|
|
* CTFontDescriptorIsSystemUIFont is a private API, we're using an
|
|
|
|
|
_interesting_ technique in the MAS build to determine if the font is a
|
|
|
|
|
system font by checking if it's kCTFontPriorityAttribute is set to
|
|
|
|
|
system priority.
|
|
|
|
|
|
|
|
|
|
diff --git a/base/BUILD.gn b/base/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 7f98c195c12b141a792913b3e9888d8eeabc74ed..901119f3fdc81800592b6f5a987054c3c62374c6 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/base/BUILD.gn
|
|
|
|
|
+++ b/base/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -1059,6 +1059,7 @@ component("base") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//build:ios_buildflags",
|
|
|
|
|
"//build/config/compiler:compiler_buildflags",
|
|
|
|
|
"//third_party/modp_b64",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
2025-06-26 00:12:49 +09:00
|
|
|
|
|
|
|
|
# Used by metrics/crc32
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
index 4bf9a3c27e05c6635b2beb8e880b5b43dbed61b5..f328fbb49c45991f44a9c75325491d0873746b61 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/base/enterprise_util_mac.mm
|
|
|
|
|
+++ b/base/enterprise_util_mac.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -16,6 +16,7 @@
|
|
|
|
|
#include "base/strings/string_split.h"
|
|
|
|
|
#include "base/strings/string_util.h"
|
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
|
|
|
|
|
namespace base {
|
|
|
|
|
|
|
|
|
|
@@ -116,6 +117,14 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
2023-11-21 10:53:21 -08:00
|
|
|
DeviceUserDomainJoinState state{.device_joined = false,
|
|
|
|
|
.user_joined = false};
|
|
|
|
|
|
|
|
|
|
+#if IS_MAS_BUILD()
|
|
|
|
|
+ return state;
|
|
|
|
|
+ }();
|
|
|
|
|
+
|
|
|
|
|
+ return state;
|
|
|
|
|
+}
|
|
|
|
|
+#else
|
|
|
|
|
+
|
|
|
|
|
@autoreleasepool {
|
|
|
|
|
ODSession* session = [ODSession defaultSession];
|
|
|
|
|
if (session == nil) {
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -219,5 +228,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
} // namespace base
|
|
|
|
|
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
2025-07-31 18:11:00 -04:00
|
|
|
index b63d58da9837ba4d1e4aff8f24f2cd977c5ed02d..8387fd7d2bcf8951b6cc024829c16d970799190c 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/base/process/launch_mac.cc
|
|
|
|
|
+++ b/base/process/launch_mac.cc
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -84,6 +84,10 @@ int posix_spawnattr_set_csm_np(const posix_spawnattr_t*, uint32_t)
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "base/threading/scoped_blocking_call.h"
|
|
|
|
|
#include "base/threading/thread_restrictions.h"
|
2025-06-26 00:12:49 +09:00
|
|
|
#include "base/trace_event/trace_event.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
+#if IS_MAS_BUILD()
|
|
|
|
|
+#include <sys/syscall.h>
|
|
|
|
|
+#endif
|
|
|
|
|
|
2025-04-22 15:53:29 -04:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
|
|
|
#include "base/apple/mach_port_rendezvous_mac.h"
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -92,9 +96,11 @@ int posix_spawnattr_set_csm_np(const posix_spawnattr_t*, uint32_t)
|
2023-11-21 10:53:21 -08:00
|
|
|
extern "C" {
|
|
|
|
|
// Changes the current thread's directory to a path or directory file
|
|
|
|
|
// descriptor.
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
int pthread_chdir_np(const char* dir);
|
|
|
|
|
|
|
|
|
|
int pthread_fchdir_np(int fd);
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs,
|
|
|
|
|
int disclaim);
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -171,13 +177,27 @@ class PosixSpawnFileActions {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
#if !BUILDFLAG(IS_MAC)
|
|
|
|
|
int ChangeCurrentThreadDirectory(const char* path) {
|
|
|
|
|
+#if IS_MAS_BUILD()
|
|
|
|
|
+ #pragma clang diagnostic push
|
|
|
|
|
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
|
+ return syscall(SYS___pthread_chdir, path);
|
|
|
|
|
+ #pragma clang diagnostic pop
|
|
|
|
|
+#else
|
|
|
|
|
return pthread_chdir_np(path);
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The recommended way to unset a per-thread cwd is to set a new value to an
|
|
|
|
|
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
|
|
|
|
|
int ResetCurrentThreadDirectory() {
|
|
|
|
|
+#if IS_MAS_BUILD()
|
|
|
|
|
+ #pragma clang diagnostic push
|
|
|
|
|
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
|
+ return syscall(SYS___pthread_fchdir, -1);
|
|
|
|
|
+ #pragma clang diagnostic pop
|
|
|
|
|
+#else
|
|
|
|
|
return pthread_fchdir_np(-1);
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -301,7 +321,7 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
2023-11-21 10:53:21 -08:00
|
|
|
file_actions.Inherit(STDERR_FILENO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-#if BUILDFLAG(IS_MAC)
|
|
|
|
|
+#if 0
|
|
|
|
|
if (options.disclaim_responsibility) {
|
|
|
|
|
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
|
|
|
|
}
|
2025-02-06 15:30:54 -05:00
|
|
|
diff --git a/base/process/process_info_mac.mm b/base/process/process_info_mac.mm
|
|
|
|
|
index e12c1d078147d956a1d9b1bc498c1b1d6fe7b974..233362259dc4e728ed37435e650417647b45a6af 100644
|
|
|
|
|
--- a/base/process/process_info_mac.mm
|
|
|
|
|
+++ b/base/process/process_info_mac.mm
|
|
|
|
|
@@ -4,15 +4,20 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
|
|
|
|
|
#include "base/process/process_info.h"
|
|
|
|
|
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
+
|
2025-02-06 15:30:54 -05:00
|
|
|
#import <AppKit/AppKit.h>
|
2023-11-21 10:53:21 -08:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
pid_t responsibility_get_pid_responsible_for_pid(pid_t);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
2025-02-06 15:30:54 -05:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
bool AppContainsBluetoothUsageDescription(NSRunningApplication* app) {
|
|
|
|
|
NSURL* bundle_url = app.bundleURL;
|
|
|
|
|
if (!bundle_url) {
|
|
|
|
|
@@ -24,12 +29,14 @@ bool AppContainsBluetoothUsageDescription(NSRunningApplication* app) {
|
|
|
|
|
[bundle objectForInfoDictionaryKey:@"NSBluetoothAlwaysUsageDescription"];
|
|
|
|
|
return bluetooth_entry != nil;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2023-11-21 10:53:21 -08:00
|
|
|
namespace base {
|
|
|
|
|
|
2025-02-06 15:30:54 -05:00
|
|
|
bool DoesResponsibleProcessHaveBluetoothMetadata() {
|
2023-11-21 10:53:21 -08:00
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
const pid_t pid = getpid();
|
2025-02-06 15:30:54 -05:00
|
|
|
const pid_t responsible_pid = responsibility_get_pid_responsible_for_pid(pid);
|
|
|
|
|
// Returns true directly if this is a self-responsible app(e.g. Chrome opens
|
|
|
|
|
@@ -46,6 +53,9 @@ bool DoesResponsibleProcessHaveBluetoothMetadata() {
|
|
|
|
|
return AppContainsBluetoothUsageDescription(app);
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2023-11-21 10:53:21 -08:00
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace base
|
|
|
|
|
diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index bbaf1143e725a1b6c49eef705b1e62c4133bfa27..81fc444043b67858371142075f98ad9aff162fc3 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/os_crypt/sync/BUILD.gn
|
|
|
|
|
+++ b/components/os_crypt/sync/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -75,6 +75,8 @@ component("sync") {
|
2023-11-21 10:53:21 -08:00
|
|
|
"os_crypt_mac.mm",
|
|
|
|
|
]
|
2024-01-25 12:46:30 -05:00
|
|
|
deps += [ "//crypto:mock_apple_keychain" ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2025-01-23 23:07:43 -05:00
|
|
|
+
|
|
|
|
|
} else if (is_win) {
|
|
|
|
|
sources += [ "os_crypt_win.cc" ]
|
|
|
|
|
deps += [ "//components/version_info" ]
|
2024-09-17 01:38:56 -07:00
|
|
|
diff --git a/components/os_crypt/sync/keychain_password_mac.mm b/components/os_crypt/sync/keychain_password_mac.mm
|
2025-07-31 18:11:00 -04:00
|
|
|
index 1d4c16a300227e5e8269e2c2564cb5e87ec8ee65..3bcbb33700b2b9349795c05c12e44b4fafcc0370 100644
|
2024-09-17 01:38:56 -07:00
|
|
|
--- a/components/os_crypt/sync/keychain_password_mac.mm
|
|
|
|
|
+++ b/components/os_crypt/sync/keychain_password_mac.mm
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -16,6 +16,7 @@
|
|
|
|
|
#include "base/strings/string_view_util.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "build/branding_buildflags.h"
|
2025-07-31 18:11:00 -04:00
|
|
|
#include "crypto/apple/keychain.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2025-06-03 11:19:20 -04:00
|
|
|
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
|
2025-07-31 18:11:00 -04:00
|
|
|
using crypto::apple::Keychain;
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
index ba813851fde2660c21f99248a124161d2ac2ca07..c34f920e4a592b6798f5307c726bc34ebedf3f88 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/BUILD.gn
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -77,6 +77,7 @@ component("app_shim") {
|
2024-10-20 19:02:21 -05:00
|
|
|
"//components/crash/core/common",
|
|
|
|
|
"//components/remote_cocoa/common:mojo",
|
|
|
|
|
"//components/system_media_controls",
|
2024-09-17 01:38:56 -07:00
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2024-10-20 19:02:21 -05:00
|
|
|
"//mojo/public/cpp/bindings",
|
|
|
|
|
"//net",
|
|
|
|
|
"//ui/accelerated_widget_mac",
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm
|
2025-09-08 17:08:42 -04:00
|
|
|
index b5801f8d4b4d5f5ed9f70b61cbd63f28a80840a6..7bf371952ba5ce01f28c79ffe156ee33812d6874 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/application_bridge.mm
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -12,6 +12,7 @@
|
|
|
|
|
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
|
|
|
|
|
#include "components/remote_cocoa/app_shim/native_widget_ns_window_host_helper.h"
|
|
|
|
|
#include "components/system_media_controls/mac/remote_cocoa/system_media_controls_bridge.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_remote.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
|
|
|
|
|
@@ -51,6 +52,7 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
// NativeWidgetNSWindowHostHelper:
|
|
|
|
|
id GetNativeViewAccessible() override {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (!remote_accessibility_element_) {
|
2024-02-29 10:31:13 +01:00
|
|
|
base::ProcessId browser_pid = base::kNullProcessId;
|
2023-11-21 10:53:21 -08:00
|
|
|
std::vector<uint8_t> element_token;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -61,6 +63,9 @@ id GetNativeViewAccessible() override {
|
2023-11-21 10:53:21 -08:00
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
|
|
|
}
|
|
|
|
|
return remote_accessibility_element_;
|
|
|
|
|
+#else
|
|
|
|
|
+ return nil;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
|
|
|
|
bool event_handled = false;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -99,7 +104,9 @@ void GetWordAt(const gfx::Point& location_in_content,
|
2023-11-21 10:53:21 -08:00
|
|
|
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
|
|
|
|
|
+#endif
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-08 17:08:42 -04:00
|
|
|
bool g_is_out_of_process_app_shim = false;
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
|
2025-07-21 09:32:53 -07:00
|
|
|
index f7200edbe6059ac6d7ade0672852b52da7642a71..0cc5da96411b46eb39d0c01dfec59cb503df0d9b 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
|
2024-11-19 19:52:20 -08:00
|
|
|
@@ -9,7 +9,9 @@
|
2025-03-10 00:30:34 -05:00
|
|
|
#include "base/mac/mac_util.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
|
|
|
|
|
#include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
2024-11-19 19:52:20 -08:00
|
|
|
namespace {
|
|
|
|
|
// Workaround for https://crbug.com/1369643
|
|
|
|
|
const double kThinControllerHeight = 0.5;
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -125,12 +127,15 @@ - (void)maybeShowTrafficLights {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
@implementation BrowserNativeWidgetWindow
|
|
|
|
|
|
2024-11-19 19:52:20 -08:00
|
|
|
@synthesize thinTitlebarViewController = _thinTitlebarViewController;
|
|
|
|
|
|
2023-11-21 10:53:21 -08:00
|
|
|
// NSWindow (PrivateAPI) overrides.
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
|
|
|
|
// - NSThemeFrame and its subclasses will be nil if it's missing at runtime.
|
|
|
|
|
if ([BrowserWindowFrame class])
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -189,6 +194,8 @@ - (BOOL)_usesCustomDrawing {
|
2023-11-21 10:53:21 -08:00
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
// Handle "Move focus to the window toolbar" configured in System Preferences ->
|
|
|
|
|
// Keyboard -> Shortcuts -> Keyboard. Usually Ctrl+F5. The argument (|unknown|)
|
|
|
|
|
// tends to just be nil.
|
2025-07-21 09:32:53 -07:00
|
|
|
@@ -199,8 +206,8 @@ - (void)_handleFocusToolbarHotKey:(id)unknown {
|
2024-10-01 19:34:32 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)setAlwaysShowTrafficLights:(BOOL)alwaysShow {
|
|
|
|
|
- [base::apple::ObjCCastStrict<BrowserWindowFrame>(self.contentView.superview)
|
|
|
|
|
- setAlwaysShowTrafficLights:alwaysShow];
|
|
|
|
|
+ // [base::apple::ObjCCastStrict<BrowserWindowFrame>(self.contentView.superview)
|
|
|
|
|
+ // setAlwaysShowTrafficLights:alwaysShow];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
index 3a815ebf505bd95fa7f6b61ba433d98fbfe20225..149de0175c2ec0e41e3ba40caad7019ca87386d6 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -4,6 +4,10 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
#import "components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.h"
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
+
|
2023-11-21 10:53:21 -08:00
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+
|
|
|
|
|
@interface NSWindow (PrivateAPI)
|
|
|
|
|
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
|
|
|
|
|
@end
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -18,8 +22,12 @@ - (CGFloat)_titlebarHeight {
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
@implementation NativeWidgetMacFramelessNSWindow
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+
|
|
|
|
|
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
|
|
|
|
if ([NativeWidgetMacFramelessNSWindowFrame class]) {
|
|
|
|
|
return [NativeWidgetMacFramelessNSWindowFrame class];
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -27,4 +35,6 @@ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
2023-11-21 10:53:21 -08:00
|
|
|
return [super frameViewClassForStyleMask:windowStyle];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
@end
|
|
|
|
|
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
|
2025-06-26 00:12:49 +09:00
|
|
|
index 71158ca9a7101911bb76f0c1b5300b0ff0e326b3..1441b9d4f9560c8b26d4beffe31449ed2a1eed40 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -9,6 +9,7 @@
|
|
|
|
|
|
|
|
|
|
#include "base/apple/foundation_util.h"
|
|
|
|
|
#include "components/remote_cocoa/app_shim/remote_cocoa_app_shim_export.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#import "ui/base/cocoa/command_dispatcher.h"
|
|
|
|
|
|
|
|
|
|
namespace remote_cocoa {
|
|
|
|
|
@@ -17,6 +18,7 @@ class NativeWidgetNSWindowBridge;
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
@protocol WindowTouchBarDelegate;
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Weak lets Chrome launch even if a future macOS doesn't have the below classes
|
|
|
|
|
WEAK_IMPORT_ATTRIBUTE
|
|
|
|
|
@interface NSNextStepFrame : NSView
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -33,6 +35,7 @@ REMOTE_COCOA_APP_SHIM_EXPORT
|
2023-11-21 10:53:21 -08:00
|
|
|
REMOTE_COCOA_APP_SHIM_EXPORT
|
|
|
|
|
@interface NativeWidgetMacNSWindowTitledFrame : NSThemeFrame
|
|
|
|
|
@end
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that
|
|
|
|
|
// can only be accomplished by overriding methods.
|
|
|
|
|
diff --git a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index 433f12928857e288b6b0d4f4dd3d1f29da08cf6c..bb95aabec2e0d5c7b3a5d315c9a3f8cb3a45c8d2 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -21,6 +21,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#import "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
|
|
|
|
|
#import "components/remote_cocoa/app_shim/window_touch_bar_delegate.h"
|
|
|
|
|
#include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
|
|
|
|
|
+#include "electron/mas.h"
|
2025-02-06 15:30:54 -05:00
|
|
|
#include "ui/accessibility/platform/ax_platform_node.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
#import "ui/base/cocoa/user_interface_item_command_handler.h"
|
|
|
|
|
#import "ui/base/cocoa/window_size_constants.h"
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -108,14 +109,18 @@ void OrderChildWindow(NSWindow* child_window,
|
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 08:59:44 -07:00
|
|
|
|
2023-11-21 10:53:21 -08:00
|
|
|
} // namespace
|
|
|
|
|
|
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 08:59:44 -07:00
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
@interface NSNextStepFrame (Private)
|
|
|
|
|
- (instancetype)initWithFrame:(NSRect)frame
|
|
|
|
|
styleMask:(NSUInteger)styleMask
|
|
|
|
|
owner:(id)owner;
|
|
|
|
|
@end
|
|
|
|
|
+#endif
|
|
|
|
|
|
2023-11-21 10:53:21 -08:00
|
|
|
@interface NSWindow (Private)
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle;
|
|
|
|
|
+#endif
|
|
|
|
|
- (BOOL)hasKeyAppearance;
|
|
|
|
|
- (long long)_resizeDirectionForMouseLocation:(CGPoint)location;
|
|
|
|
|
- (BOOL)_isConsideredOpenForPersistentState;
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -165,6 +170,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+
|
|
|
|
|
@implementation NativeWidgetMacNSWindowTitledFrame
|
|
|
|
|
- (void)mouseDown:(NSEvent*)event {
|
|
|
|
|
if (self.window.isMovable)
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -192,6 +199,8 @@ - (BOOL)usesCustomDrawing {
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
@implementation NativeWidgetMacNSWindow {
|
|
|
|
|
@private
|
|
|
|
|
CommandDispatcher* __strong _commandDispatcher;
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -389,6 +398,8 @@ - (NSAccessibilityRole)accessibilityRole {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
// NSWindow overrides.
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+
|
|
|
|
|
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
|
|
|
|
if (windowStyle & NSWindowStyleMaskTitled) {
|
|
|
|
|
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -400,6 +411,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
2023-11-21 10:53:21 -08:00
|
|
|
return [super frameViewClassForStyleMask:windowStyle];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
- (BOOL)_isTitleHidden {
|
|
|
|
|
bool shouldShowWindowTitle = YES;
|
|
|
|
|
if (_bridge)
|
|
|
|
|
diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index e90c5a7cbb852ba33df47209cfb7890472f1fbb1..53881e0efdf8f868245dbca7040cd6aac899d50c 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
|
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
2025-03-13 12:02:06 -05:00
|
|
|
@@ -42,6 +42,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#import "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
|
|
|
|
|
#import "components/remote_cocoa/app_shim/window_move_loop.h"
|
|
|
|
|
#include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
|
|
|
|
|
#include "net/cert/x509_util_apple.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
|
2025-04-25 14:53:51 +09:00
|
|
|
@@ -691,10 +692,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
2023-11-21 10:53:21 -08:00
|
|
|
// this should be treated as an error and caught early.
|
|
|
|
|
CHECK(bridged_view_);
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Send the accessibility tokens for the NSView now that it exists.
|
|
|
|
|
host_->SetRemoteAccessibilityTokens(
|
|
|
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window_),
|
|
|
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(bridged_view_));
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Beware: This view was briefly removed (in favor of a bare CALayer) in
|
|
|
|
|
// https://crrev.com/c/1236675. The ordering of unassociated layers relative
|
|
|
|
|
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 9f487674f174e69c749c93e030de66e954947a73..88b4d3e2d965ee6930b4d5dd49c75af079c1bcff 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/components/viz/service/BUILD.gn
|
|
|
|
|
+++ b/components/viz/service/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -385,6 +385,7 @@ viz_component("service") {
|
2023-11-21 10:53:21 -08:00
|
|
|
"frame_sinks/external_begin_frame_source_mac.h",
|
|
|
|
|
]
|
|
|
|
|
}
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
2025-04-22 15:53:29 -04:00
|
|
|
if (is_ios) {
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -708,6 +709,7 @@ viz_source_set("unit_tests") {
|
2023-11-21 10:53:21 -08:00
|
|
|
"display_embedder/software_output_device_mac_unittest.mm",
|
|
|
|
|
]
|
|
|
|
|
frameworks = [ "IOSurface.framework" ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_win) {
|
|
|
|
|
diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
2025-06-26 00:12:49 +09:00
|
|
|
index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bdded41dba 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
|
|
|
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -15,6 +15,7 @@
|
|
|
|
|
#include "content/common/web_contents_ns_view_bridge.mojom.h"
|
|
|
|
|
#include "content/public/browser/remote_cocoa.h"
|
|
|
|
|
#include "content/public/browser/render_widget_host_view_mac_delegate.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_remote.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
|
|
|
|
|
@@ -63,7 +64,9 @@ explicit RenderWidgetHostNSViewBridgeOwner(
|
2024-02-29 10:31:13 +01:00
|
|
|
const RenderWidgetHostNSViewBridgeOwner&) = delete;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
|
|
|
|
|
+#endif
|
|
|
|
|
void OnMojoDisconnect() { delete this; }
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<blink::WebCoalescedInputEvent> TranslateEvent(
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -75,6 +78,7 @@ explicit RenderWidgetHostNSViewBridgeOwner(
|
2024-02-29 10:31:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
id GetAccessibilityElement() override {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (!remote_accessibility_element_) {
|
|
|
|
|
base::ProcessId browser_pid = base::kNullProcessId;
|
|
|
|
|
std::vector<uint8_t> element_token;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -85,6 +89,9 @@ id GetAccessibilityElement() override {
|
2024-02-29 10:31:13 +01:00
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
|
|
|
}
|
|
|
|
|
return remote_accessibility_element_;
|
|
|
|
|
+#else
|
|
|
|
|
+ return nil;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RenderWidgetHostNSViewHostHelper implementation.
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -103,8 +110,10 @@ id GetFocusedBrowserAccessibilityElement() override {
|
2024-02-21 15:27:05 -05:00
|
|
|
return [bridgedContentView accessibilityFocusedUIElement];
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
void SetAccessibilityWindow(NSWindow* window) override {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
host_->SetRemoteAccessibilityWindowToken(
|
|
|
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window));
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-07 17:18:35 -04:00
|
|
|
void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event,
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index d3f833904a7a056235d4bd4b3e7c5297a60861f5..8986ec2405541a43ca34d47f9ac0ffbf875ae63a 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
|
|
|
|
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
2025-07-22 16:09:47 -07:00
|
|
|
@@ -34,6 +34,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#import "content/public/browser/render_widget_host_view_mac_delegate.h"
|
2025-05-01 23:53:40 -05:00
|
|
|
#include "content/public/browser/scoped_accessibility_mode.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "content/public/common/content_features.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "skia/ext/skia_utils_mac.h"
|
|
|
|
|
#include "third_party/blink/public/common/features.h"
|
|
|
|
|
#include "third_party/blink/public/mojom/input/input_handler.mojom.h"
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -2095,15 +2096,21 @@ - (NSAccessibilityRole)accessibilityRole {
|
2023-11-21 10:53:21 -08:00
|
|
|
// Since this implementation doesn't have to wait any IPC calls, this doesn't
|
|
|
|
|
// make any key-typing jank. --hbono 7/23/09
|
|
|
|
|
//
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
extern NSString* NSTextInputReplacementRangeAttributeName;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
- (NSArray*)validAttributesForMarkedText {
|
|
|
|
|
// This code is just copied from WebKit except renaming variables.
|
|
|
|
|
static NSArray* const kAttributes = @[
|
|
|
|
|
NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName,
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
NSMarkedClauseSegmentAttributeName, NSTextInputReplacementRangeAttributeName
|
|
|
|
|
+#else
|
|
|
|
|
+ NSMarkedClauseSegmentAttributeName
|
|
|
|
|
+#endif
|
|
|
|
|
];
|
|
|
|
|
return kAttributes;
|
|
|
|
|
}
|
|
|
|
|
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index bb12a1600ddda11abb6485f685564e2d5a7a5837..a1bcbbaca764ae901dad961c94a8a33432a92bd2 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/browser/BUILD.gn
|
|
|
|
|
+++ b/content/browser/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -347,6 +347,7 @@ source_set("browser") {
|
2025-01-10 10:52:34 -06:00
|
|
|
"//ui/webui/resources",
|
2025-02-21 14:46:51 -08:00
|
|
|
"//v8",
|
2024-09-17 01:38:56 -07:00
|
|
|
"//v8:v8_version",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
2024-09-17 01:38:56 -07:00
|
|
|
|
|
|
|
|
public_deps = [
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
|
2025-09-24 11:56:54 -04:00
|
|
|
index 319e58e5c3cad4ec47fca2c7cb0d59d4c5fd460c..d17bdb51081cee80f6f43199057de557063ecf1a 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
|
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
|
2025-02-21 14:46:51 -08:00
|
|
|
@@ -24,6 +24,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "content/browser/renderer_host/text_input_manager.h"
|
|
|
|
|
#include "content/common/content_export.h"
|
|
|
|
|
#include "content/common/render_widget_host_ns_view.mojom.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_remote.h"
|
|
|
|
|
#include "third_party/blink/public/mojom/webshare/webshare.mojom.h"
|
2025-02-21 14:46:51 -08:00
|
|
|
@@ -54,7 +55,9 @@ class CursorManager;
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
@protocol RenderWidgetHostViewMacDelegate;
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
@class NSAccessibilityRemoteUIElement;
|
|
|
|
|
+#endif
|
|
|
|
|
@class RenderWidgetHostViewCocoa;
|
|
|
|
|
|
2024-08-21 12:34:18 -04:00
|
|
|
namespace content {
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -675,9 +678,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
|
2023-11-21 10:53:21 -08:00
|
|
|
// EnsureSurfaceSynchronizedForWebTest().
|
|
|
|
|
uint32_t latest_capture_sequence_number_ = 0u;
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Remote accessibility objects corresponding to the NSWindow that this is
|
|
|
|
|
// displayed to the user in.
|
|
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Used to force the NSApplication's focused accessibility element to be the
|
|
|
|
|
// content::BrowserAccessibilityCocoa accessibility tree when the NSView for
|
|
|
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index 8b53385eacb73bbafa1a095bd2db833ecfd930bb..3798a24ce4aedb6aa2954d8f99b603bf08f1179d 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
|
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -52,6 +52,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "content/public/browser/render_widget_host.h"
|
|
|
|
|
#include "content/public/browser/web_contents.h"
|
|
|
|
|
#include "content/public/common/page_visibility_state.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "media/base/media_switches.h"
|
|
|
|
|
#include "skia/ext/platform_canvas.h"
|
|
|
|
|
#include "skia/ext/skia_utils_mac.h"
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -274,8 +275,10 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
void RenderWidgetHostViewMac::MigrateNSViewBridge(
|
|
|
|
|
remote_cocoa::mojom::Application* remote_cocoa_application,
|
|
|
|
|
uint64_t parent_ns_view_id) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Destroy the previous remote accessibility element.
|
|
|
|
|
remote_window_accessible_ = nil;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling
|
|
|
|
|
// pointers. `ns_view_` gets reinitialized later in this method.
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -1638,10 +1641,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
gfx::NativeViewAccessible
|
|
|
|
|
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
2025-04-22 15:53:29 -04:00
|
|
|
if (remote_window_accessible_) {
|
|
|
|
|
return gfx::NativeViewAccessible(
|
|
|
|
|
(id<NSAccessibility>)remote_window_accessible_);
|
|
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
+#endif
|
2025-04-22 15:53:29 -04:00
|
|
|
return gfx::NativeViewAccessible([GetInProcessNSView() window]);
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -1693,9 +1698,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// When running in-process, just use the NSView's NSWindow as its own
|
|
|
|
|
// accessibility element.
|
|
|
|
|
remote_window_accessible_ = nil;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -2198,20 +2205,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2024-02-29 10:31:13 +01:00
|
|
|
void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken(
|
|
|
|
|
GetRenderWidgetAccessibilityTokenCallback callback) {
|
|
|
|
|
base::ProcessId pid = getpid();
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
2025-04-22 15:53:29 -04:00
|
|
|
id element_id = GetNativeViewAccessible().Get();
|
2024-02-29 10:31:13 +01:00
|
|
|
std::vector<uint8_t> token =
|
|
|
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
|
|
|
|
std::move(callback).Run(pid, token);
|
|
|
|
|
+#else
|
|
|
|
|
+ std::move(callback).Run(pid, std::vector<uint8_t>());
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
|
|
|
|
|
const std::vector<uint8_t>& window_token) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (window_token.empty()) {
|
|
|
|
|
remote_window_accessible_ = nil;
|
|
|
|
|
} else {
|
|
|
|
|
remote_window_accessible_ =
|
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 8c293f5bb0e859f438a7ab50b70b4d5449dc1358..d58c73427935127fdec173224bcb970964a9f14d 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/common/BUILD.gn
|
|
|
|
|
+++ b/content/common/BUILD.gn
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -275,6 +275,7 @@ source_set("common") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/shell_dialogs",
|
|
|
|
|
"//url",
|
|
|
|
|
"//url/ipc:url_ipc",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
defines = []
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
|
2025-08-29 12:31:47 +09:00
|
|
|
index b31aef089e03d530831df59327936785f026a300..457f5c907169da132cfd6304241dcecae779fc69 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/renderer/BUILD.gn
|
|
|
|
|
+++ b/content/renderer/BUILD.gn
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -320,6 +320,7 @@ target(link_target_type, "renderer") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/surface",
|
|
|
|
|
"//url",
|
|
|
|
|
"//v8",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
|
|
|
|
]
|
|
|
|
|
allow_circular_includes_from = []
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
index d4db3b179725cb96bcbd0f73db7d52ef8b7522db..703b0f56a61abac51961bfd918b7349b943900de 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/renderer/renderer_main_platform_delegate_mac.mm
|
|
|
|
|
+++ b/content/renderer/renderer_main_platform_delegate_mac.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -7,12 +7,15 @@
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
|
|
#include "base/check_op.h"
|
|
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "sandbox/mac/seatbelt.h"
|
|
|
|
|
#include "sandbox/mac/system_services.h"
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
CGError CGSSetDenyWindowServerConnections(bool);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -22,6 +25,7 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
// verifies there are no existing open connections), and then indicates that
|
|
|
|
|
// Chrome should continue execution without access to launchservicesd.
|
|
|
|
|
void DisableSystemServices() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Tell the WindowServer that we don't want to make any future connections.
|
|
|
|
|
// This will return Success as long as there are no open connections, which
|
|
|
|
|
// is what we want.
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -30,6 +34,7 @@ void DisableSystemServices() {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
sandbox::DisableLaunchServices();
|
|
|
|
|
sandbox::DisableCoreServicesCheckFix();
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
diff --git a/content/renderer/theme_helper_mac.mm b/content/renderer/theme_helper_mac.mm
|
2024-09-25 06:19:39 -05:00
|
|
|
index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbec3d00ff8 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/renderer/theme_helper_mac.mm
|
|
|
|
|
+++ b/content/renderer/theme_helper_mac.mm
|
2024-09-25 06:19:39 -05:00
|
|
|
@@ -7,16 +7,28 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include <Cocoa/Cocoa.h>
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
bool CGFontRenderingGetFontSmoothingDisabled(void);
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
+#endif
|
|
|
|
|
namespace content {
|
|
|
|
|
|
|
|
|
|
bool IsSubpixelAntialiasingAvailable() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// See https://trac.webkit.org/changeset/239306/webkit for more info.
|
|
|
|
|
return !CGFontRenderingGetFontSmoothingDisabled();
|
|
|
|
|
+#else
|
|
|
|
|
+ NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
+ NSString *default_key = @"CGFontRenderingGetFontSmoothingDisabled";
|
|
|
|
|
+ // Check that key exists since boolForKey defaults to NO when the
|
|
|
|
|
+ // key is missing and this key in fact defaults to YES;
|
|
|
|
|
+ if ([defaults objectForKey:default_key] == nil)
|
|
|
|
|
+ return false;
|
|
|
|
|
+ return ![defaults boolForKey:default_key];
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace content
|
|
|
|
|
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 6232ce7ac3676b0b7e15e5a3f41e2e44c4dab787..21d29e74a9c3a5d085bf451b2b5ae2fdae165c50 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/test/BUILD.gn
|
|
|
|
|
+++ b/content/test/BUILD.gn
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -673,6 +673,7 @@ static_library("test_support") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//url",
|
|
|
|
|
"//url/mojom:url_mojom_gurl",
|
|
|
|
|
"//v8",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config"
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
data_deps = [
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -1143,6 +1144,8 @@ static_library("browsertest_support") {
|
2025-07-22 16:09:47 -07:00
|
|
|
# TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
|
|
|
|
|
# enable the diagnostic by removing this line.
|
|
|
|
|
configs += [ "//build/config/compiler:no_exit_time_destructors" ]
|
|
|
|
|
+
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-12-01 00:23:21 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mojom("content_test_mojo_bindings") {
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -2030,6 +2033,7 @@ test("content_browsertests") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/shell_dialogs",
|
|
|
|
|
"//ui/snapshot",
|
|
|
|
|
"//ui/webui:test_support",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config"
|
|
|
|
|
]
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2025-01-10 10:52:34 -06:00
|
|
|
if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) {
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -3356,6 +3360,7 @@ test("content_unittests") {
|
2025-07-31 18:11:00 -04:00
|
|
|
"//ui/shell_dialogs",
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/webui:test_support",
|
2025-03-07 11:35:59 -06:00
|
|
|
"//url",
|
2025-07-31 18:11:00 -04:00
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2024-09-17 01:38:56 -07:00
|
|
|
]
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
if (enable_nocompile_tests) {
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn
|
2025-08-06 20:14:23 -04:00
|
|
|
index ab961bccc3e4f0f5a40ac74df97447118b256c68..43f00bf0879809e986308a2cb26145c4a2a51dd3 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/content/web_test/BUILD.gn
|
|
|
|
|
+++ b/content/web_test/BUILD.gn
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -227,6 +227,7 @@ static_library("web_test_browser") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/gl",
|
2025-07-31 18:11:00 -04:00
|
|
|
"//ui/shell_dialogs",
|
2024-09-17 01:38:56 -07:00
|
|
|
"//url",
|
2025-07-31 18:11:00 -04:00
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2024-09-17 01:38:56 -07:00
|
|
|
]
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2025-06-30 12:30:05 -04:00
|
|
|
if (is_mac) {
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn
|
2025-08-11 12:57:31 +09:00
|
|
|
index fdb2993ab0879c5693008fdabc10566d11e471aa..2af4bf9975385ea8080cd9bd2b55f24e3ab7a2f1 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/device/bluetooth/BUILD.gn
|
|
|
|
|
+++ b/device/bluetooth/BUILD.gn
|
2025-04-22 15:53:29 -04:00
|
|
|
@@ -256,6 +256,7 @@ component("bluetooth") {
|
|
|
|
|
"CoreBluetooth.framework",
|
2023-11-21 10:53:21 -08:00
|
|
|
"Foundation.framework",
|
|
|
|
|
]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_mac) {
|
|
|
|
|
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
2025-06-26 00:12:49 +09:00
|
|
|
index f300e8d331057e894b43b74944e5052c39206844..4ff5277d550485cd79c5b5316d89c730ba709254 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
|
|
|
|
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -39,7 +39,9 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "device/bluetooth/bluetooth_discovery_session_outcome.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "device/bluetooth/bluetooth_socket_mac.h"
|
|
|
|
|
#include "device/bluetooth/public/cpp/bluetooth_address.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
// Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and
|
|
|
|
|
// `Karabiner` [3] to programmatically control the Bluetooth state. Calling the
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -53,6 +55,7 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
// [4] https://support.apple.com/kb/PH25091
|
|
|
|
|
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
2024-07-02 09:51:33 +02:00
|
|
|
// A simple helper class that forwards any Bluetooth device connect notification
|
|
|
|
|
// to its wrapped |_adapter|.
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -162,8 +165,10 @@ bool IsDeviceSystemPaired(const std::string& device_address) {
|
2023-11-21 10:53:21 -08:00
|
|
|
: controller_state_function_(
|
|
|
|
|
base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
|
|
|
|
|
base::Unretained(this))),
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
power_state_function_(
|
|
|
|
|
base::BindRepeating(IOBluetoothPreferenceSetControllerPowerState)),
|
|
|
|
|
+#endif
|
|
|
|
|
device_paired_status_callback_(
|
2024-01-03 09:52:49 +01:00
|
|
|
base::BindRepeating(&IsDeviceSystemPaired)) {
|
|
|
|
|
}
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -314,8 +319,12 @@ bool IsDeviceSystemPaired(const std::string& device_address) {
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
power_state_function_.Run(base::strict_cast<int>(powered));
|
|
|
|
|
return true;
|
|
|
|
|
+#else
|
|
|
|
|
+ return false;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base::WeakPtr<BluetoothLowEnergyAdapterApple>
|
|
|
|
|
diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn
|
2025-07-31 18:11:00 -04:00
|
|
|
index 1e35afb74f7a149fb01ec2a2c62547a8aa6f1de1..05f4628930e74ea668a85968f74c678e57a6429d 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/gpu/ipc/service/BUILD.gn
|
|
|
|
|
+++ b/gpu/ipc/service/BUILD.gn
|
2025-07-22 16:09:47 -07:00
|
|
|
@@ -128,6 +128,7 @@ component("service") {
|
2025-04-24 17:18:38 +09:00
|
|
|
"QuartzCore.framework",
|
|
|
|
|
]
|
|
|
|
|
defines += [ "GL_SILENCE_DEPRECATION" ]
|
|
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
|
|
|
}
|
|
|
|
|
if (is_ios) {
|
|
|
|
|
sources += [ "image_transport_surface_ios.mm" ]
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h
|
2025-07-22 16:09:47 -07:00
|
|
|
index d288ffce5c1265adbdefc571f840851026e7479e..e9a6e8c31401750d270fcc55ef1116b2608b65b5 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.h
|
|
|
|
|
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -8,6 +8,7 @@
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "gpu/ipc/service/command_buffer_stub.h"
|
|
|
|
|
#include "gpu/ipc/service/image_transport_surface.h"
|
|
|
|
|
#include "ui/gfx/ca_layer_result.h"
|
2025-02-21 14:46:51 -08:00
|
|
|
@@ -27,7 +28,9 @@
|
|
|
|
|
#include <BrowserEngineKit/BrowserEngineKit.h>
|
2023-11-21 10:53:21 -08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
@class CAContext;
|
|
|
|
|
+#endif
|
|
|
|
|
@class CALayer;
|
|
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
index 7bc208697690ac36a3fc546748a05cbe952f1003..2fa14c45a5f3ce23985b7e9e9b2c2a14d3596d63 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/media/audio/BUILD.gn
|
|
|
|
|
+++ b/media/audio/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -203,6 +203,7 @@ source_set("audio") {
|
2023-11-21 10:53:21 -08:00
|
|
|
"CoreMedia.framework",
|
|
|
|
|
]
|
|
|
|
|
weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_ios) {
|
2024-01-25 18:57:47 -05:00
|
|
|
diff --git a/media/audio/apple/audio_low_latency_input.cc b/media/audio/apple/audio_low_latency_input.cc
|
2025-09-08 17:08:42 -04:00
|
|
|
index 5eda5e58b30b84795ec3827aad7ce97171400097..60bf6c34e8d824ea6d4e02b2951568604db68f43 100644
|
2024-01-25 18:57:47 -05:00
|
|
|
--- a/media/audio/apple/audio_low_latency_input.cc
|
|
|
|
|
+++ b/media/audio/apple/audio_low_latency_input.cc
|
2024-12-10 13:16:07 -06:00
|
|
|
@@ -29,6 +29,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
|
#include "base/time/time.h"
|
|
|
|
|
#include "base/trace_event/trace_event.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "media/audio/apple/audio_manager_apple.h"
|
|
|
|
|
#include "media/audio/apple/scoped_audio_unit.h"
|
|
|
|
|
#include "media/base/audio_bus.h"
|
2024-12-10 13:16:07 -06:00
|
|
|
@@ -41,19 +42,23 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
extern "C" {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// See:
|
|
|
|
|
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
|
|
|
|
|
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
|
|
|
|
|
Float32 inDuckedLevel,
|
|
|
|
|
const AudioTimeStamp* __nullable inStartTime,
|
|
|
|
|
Float32 inRampDuration) __attribute__((weak_import));
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UndoDucking(AudioDeviceID output_device_id) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (AudioDeviceDuck != nullptr) {
|
|
|
|
|
// Ramp the volume back up over half a second.
|
|
|
|
|
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
} // namespace
|
2024-01-11 19:33:40 +13:00
|
|
|
#endif
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 4428896957be15908ce992189db2a0fe95ba3bbd..07987fad41d194bf38a6f4265ccbd853c1273689 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/net/dns/BUILD.gn
|
|
|
|
|
+++ b/net/dns/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -195,6 +195,8 @@ source_set("dns") {
|
2023-11-21 10:53:21 -08:00
|
|
|
":host_resolver_manager",
|
|
|
|
|
":mdns_client",
|
|
|
|
|
]
|
|
|
|
|
+
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# The standard API of net/dns.
|
|
|
|
|
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
|
2024-09-17 01:38:56 -07:00
|
|
|
index 70d5665ad7b9ef62370497636af919ede2508ad4..f4dc3e2b8053cdb3e8c439ab1a1d6369a8e6a7dc 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/net/dns/dns_config_service_posix.cc
|
|
|
|
|
+++ b/net/dns/dns_config_service_posix.cc
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -28,6 +28,7 @@
|
|
|
|
|
#include "base/threading/scoped_blocking_call.h"
|
|
|
|
|
#include "base/time/time.h"
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "net/base/ip_endpoint.h"
|
|
|
|
|
#include "net/dns/dns_config.h"
|
|
|
|
|
#include "net/dns/dns_hosts.h"
|
|
|
|
|
@@ -135,8 +136,8 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
bool Watch() override {
|
|
|
|
|
CheckOnCorrectSequence();
|
|
|
|
|
-
|
|
|
|
|
bool success = true;
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (!config_watcher_.Watch(base::BindRepeating(&Watcher::OnConfigChanged,
|
|
|
|
|
base::Unretained(this)))) {
|
|
|
|
|
LOG(ERROR) << "DNS config watch failed to start.";
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -153,6 +154,7 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher {
|
2023-11-21 10:53:21 -08:00
|
|
|
success = false;
|
|
|
|
|
}
|
|
|
|
|
#endif // !BUILDFLAG(IS_IOS)
|
|
|
|
|
+#endif
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/sandbox/mac/BUILD.gn b/sandbox/mac/BUILD.gn
|
2025-08-11 12:57:31 +09:00
|
|
|
index d145bdb3f879ae7e2d77f3b58fe7abd09d6f7255..8973f310aa62b59bc829e8e0f8ed068bfffa3f2b 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/sandbox/mac/BUILD.gn
|
|
|
|
|
+++ b/sandbox/mac/BUILD.gn
|
2025-02-11 17:26:39 -06:00
|
|
|
@@ -25,6 +25,7 @@ component("seatbelt") {
|
|
|
|
|
libs = [ "sandbox" ]
|
|
|
|
|
deps = [ ":seatbelt_export" ]
|
2023-11-21 10:53:21 -08:00
|
|
|
defines = [ "SEATBELT_IMPLEMENTATION" ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component("seatbelt_extension") {
|
2025-02-11 17:26:39 -06:00
|
|
|
@@ -38,6 +39,7 @@ component("seatbelt_extension") {
|
2023-11-21 10:53:21 -08:00
|
|
|
libs = [ "sandbox" ]
|
|
|
|
|
public_deps = [ "//base" ]
|
|
|
|
|
defines = [ "SEATBELT_IMPLEMENTATION" ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
component("system_services") {
|
2025-02-11 17:26:39 -06:00
|
|
|
@@ -52,6 +54,7 @@ component("system_services") {
|
2023-11-21 10:53:21 -08:00
|
|
|
deps = [ ":seatbelt_export" ]
|
|
|
|
|
public_deps = [ "//base" ]
|
|
|
|
|
defines = [ "SEATBELT_IMPLEMENTATION" ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
source_set("sandbox_unittests") {
|
|
|
|
|
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
|
2025-04-03 19:02:49 -05:00
|
|
|
index 950cf7cfee4e11766dccf5c0bf3f15a8562f0f1e..a5adaaabdbbd91fedbc4cb679c865bc342536090 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/sandbox/mac/sandbox_logging.cc
|
|
|
|
|
+++ b/sandbox/mac/sandbox_logging.cc
|
2025-04-03 19:02:49 -05:00
|
|
|
@@ -21,6 +21,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "sandbox/mac/sandbox_crash_message.h"
|
|
|
|
|
|
|
|
|
|
#if defined(ARCH_CPU_X86_64)
|
2025-04-03 19:02:49 -05:00
|
|
|
@@ -38,9 +39,11 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
void abort_report_np(const char*, ...);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
namespace sandbox::logging {
|
|
|
|
|
|
2025-04-03 19:02:49 -05:00
|
|
|
@@ -81,9 +84,11 @@ void SendOsLog(Level level, const char* message) {
|
2023-11-21 10:53:21 -08:00
|
|
|
sandbox::crash_message::SetCrashMessage(message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (level == Level::FATAL) {
|
|
|
|
|
abort_report_np(message);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// |error| is strerror(errno) when a P* logging function is called. Pass
|
2025-02-18 11:51:27 -05:00
|
|
|
diff --git a/sandbox/mac/sandbox_serializer.cc b/sandbox/mac/sandbox_serializer.cc
|
2025-07-22 16:09:47 -07:00
|
|
|
index 0e6e650f88e6aadd46bec96a8b41768c37d7cc6a..a6830e3f886e408c254ccd1c2b1d5c15cd3bcb92 100644
|
2025-02-18 11:51:27 -05:00
|
|
|
--- a/sandbox/mac/sandbox_serializer.cc
|
|
|
|
|
+++ b/sandbox/mac/sandbox_serializer.cc
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -8,6 +8,7 @@
|
2025-02-18 11:51:27 -05:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "sandbox/mac/sandbox_logging.h"
|
|
|
|
|
#include "sandbox/mac/seatbelt.h"
|
|
|
|
|
|
2025-07-22 16:09:47 -07:00
|
|
|
@@ -193,6 +194,7 @@ SandboxSerializer::DeserializePolicy(const std::string& serialized_policy,
|
2025-02-18 11:51:27 -05:00
|
|
|
// static
|
|
|
|
|
bool SandboxSerializer::ApplySerializedPolicy(
|
|
|
|
|
const std::string& serialized_policy) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
2025-06-16 12:46:06 -05:00
|
|
|
std::string error;
|
|
|
|
|
std::optional<DeserializedPolicy> deserialized_policy =
|
|
|
|
|
DeserializePolicy(serialized_policy, error);
|
2025-07-22 16:09:47 -07:00
|
|
|
@@ -223,6 +225,9 @@ bool SandboxSerializer::ApplySerializedPolicy(
|
2025-06-16 12:46:06 -05:00
|
|
|
break;
|
2025-02-18 11:51:27 -05:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace sandbox
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc
|
2025-08-29 12:31:47 +09:00
|
|
|
index e9321ba5fc0f1b24b2d990ecb27c8aaa1c8b970b..51df9671a507acd115f09a50c2d6e987fb4183c2 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/sandbox/mac/seatbelt.cc
|
|
|
|
|
+++ b/sandbox/mac/seatbelt.cc
|
2025-06-30 12:30:05 -04:00
|
|
|
@@ -4,6 +4,8 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
|
|
|
|
|
#include "sandbox/mac/seatbelt.h"
|
|
|
|
|
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
+
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <unistd.h>
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -12,7 +14,7 @@
|
2025-06-30 12:30:05 -04:00
|
|
|
|
2023-11-21 10:53:21 -08:00
|
|
|
extern "C" {
|
|
|
|
|
#include <sandbox.h>
|
|
|
|
|
-
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
int sandbox_init_with_parameters(const char* profile,
|
|
|
|
|
uint64_t flags,
|
|
|
|
|
const char* const parameters[],
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -58,13 +60,14 @@ sandbox_profile_t* sandbox_compile_string(const char* data,
|
2023-11-21 10:53:21 -08:00
|
|
|
char** error);
|
|
|
|
|
int sandbox_apply(sandbox_profile_t*);
|
|
|
|
|
void sandbox_free_profile(sandbox_profile_t*);
|
|
|
|
|
-
|
|
|
|
|
+#endif
|
|
|
|
|
} // extern "C"
|
|
|
|
|
|
|
|
|
|
namespace sandbox {
|
|
|
|
|
|
|
|
|
|
namespace {
|
2025-08-29 12:31:47 +09:00
|
|
|
|
2023-11-21 10:53:21 -08:00
|
|
|
+#if !IS_MAS_BUILD()
|
2025-08-29 12:31:47 +09:00
|
|
|
// `managed_errorbuf` uses a unique_ptr with a deleter to ensure that memory is
|
|
|
|
|
// freed using the sandbox library's deallocation function to prevent unexpected
|
|
|
|
|
// behavior.
|
|
|
|
|
@@ -107,36 +110,48 @@ bool HandleSandboxErrno(int rv, const char* message, std::string* error) {
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
+#endif
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
|
Seatbelt::Parameters Seatbelt::Parameters::Create() {
|
|
|
|
|
Parameters params;
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
params.params_ = ::sandbox_create_params();
|
|
|
|
|
+#endif
|
|
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Seatbelt::Parameters::Parameters() = default;
|
|
|
|
|
|
|
|
|
|
Seatbelt::Parameters::Parameters(Seatbelt::Parameters&& other) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
params_ = std::exchange(other.params_, nullptr);
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Seatbelt::Parameters& Seatbelt::Parameters::operator=(
|
|
|
|
|
Seatbelt::Parameters&& other) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
params_ = std::exchange(other.params_, nullptr);
|
|
|
|
|
+#endif
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Seatbelt::Parameters::Set(const char* key, const char* value) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
return ::sandbox_set_param(params_, key, value) == 0;
|
|
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Seatbelt::Parameters::~Parameters() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (params_) {
|
|
|
|
|
::sandbox_free_params(params_);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize the static member variables.
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -147,6 +162,7 @@ const char* Seatbelt::kProfilePureComputation = kSBXProfilePureComputation;
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
// static
|
|
|
|
|
bool Seatbelt::Init(const char* profile, uint64_t flags, std::string* error) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// OS X deprecated these functions, but did not provide a suitable replacement,
|
|
|
|
|
// so ignore the deprecation warning.
|
|
|
|
|
#pragma clang diagnostic push
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -156,6 +172,9 @@ bool Seatbelt::Init(const char* profile, uint64_t flags, std::string* error) {
|
|
|
|
|
return HandleSandboxResult(
|
|
|
|
|
rv, std::unique_ptr<char, sandbox_error_deleter>(errorbuf), error);
|
2023-11-21 10:53:21 -08:00
|
|
|
#pragma clang diagnostic pop
|
|
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// static
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -163,17 +182,22 @@ bool Seatbelt::InitWithParams(const std::string& profile,
|
2023-11-21 10:53:21 -08:00
|
|
|
uint64_t flags,
|
2025-02-11 17:26:39 -06:00
|
|
|
const std::vector<std::string>& parameters,
|
2023-11-21 10:53:21 -08:00
|
|
|
std::string* error) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
2025-02-11 17:26:39 -06:00
|
|
|
std::vector<const char*> weak_params;
|
|
|
|
|
for (const std::string& param : parameters) {
|
|
|
|
|
weak_params.push_back(param.c_str());
|
|
|
|
|
}
|
|
|
|
|
// The parameters array must be null terminated.
|
|
|
|
|
weak_params.push_back(nullptr);
|
|
|
|
|
+
|
2023-11-21 10:53:21 -08:00
|
|
|
char* errorbuf = nullptr;
|
2025-02-11 17:26:39 -06:00
|
|
|
int rv = ::sandbox_init_with_parameters(profile.c_str(), flags,
|
|
|
|
|
weak_params.data(), &errorbuf);
|
2025-08-29 12:31:47 +09:00
|
|
|
return HandleSandboxResult(
|
|
|
|
|
rv, std::unique_ptr<char, sandbox_error_deleter>(errorbuf), error);
|
2023-11-21 10:53:21 -08:00
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// static
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -181,6 +205,7 @@ bool Seatbelt::Compile(const char* profile,
|
2023-11-21 10:53:21 -08:00
|
|
|
const Seatbelt::Parameters& params,
|
|
|
|
|
std::string& compiled_profile,
|
|
|
|
|
std::string* error) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
char* errorbuf = nullptr;
|
|
|
|
|
sandbox_profile_t* sandbox_profile =
|
|
|
|
|
::sandbox_compile_string(profile, params.params(), &errorbuf);
|
2025-08-29 12:31:47 +09:00
|
|
|
@@ -192,23 +217,32 @@ bool Seatbelt::Compile(const char* profile,
|
2023-11-21 10:53:21 -08:00
|
|
|
compiled_profile.assign(reinterpret_cast<const char*>(sandbox_profile->data),
|
|
|
|
|
sandbox_profile->size);
|
|
|
|
|
::sandbox_free_profile(sandbox_profile);
|
|
|
|
|
+#endif
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
|
bool Seatbelt::ApplyCompiledProfile(const std::string& profile,
|
|
|
|
|
std::string* error) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
sandbox_profile_t sbox_profile = {
|
|
|
|
|
.builtin = nullptr,
|
|
|
|
|
.data = reinterpret_cast<const uint8_t*>(profile.data()),
|
|
|
|
|
.size = profile.size()};
|
|
|
|
|
return HandleSandboxErrno(::sandbox_apply(&sbox_profile),
|
|
|
|
|
"sandbox_apply: ", error);
|
|
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
|
bool Seatbelt::IsSandboxed() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
return ::sandbox_check(getpid(), NULL, 0);
|
|
|
|
|
+#else
|
|
|
|
|
+ return true;
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace sandbox
|
|
|
|
|
diff --git a/sandbox/mac/seatbelt_extension.cc b/sandbox/mac/seatbelt_extension.cc
|
2024-09-30 14:54:44 +02:00
|
|
|
index 79edca9ca521d1bc2ff343967348eb98039b292a..23f9410ee66024e2c6b0b6b2b356a67b0ae2eba7 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/sandbox/mac/seatbelt_extension.cc
|
|
|
|
|
+++ b/sandbox/mac/seatbelt_extension.cc
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -9,8 +9,10 @@
|
|
|
|
|
#include "base/check.h"
|
|
|
|
|
#include "base/memory/ptr_util.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "base/notreached.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "sandbox/mac/seatbelt_extension_token.h"
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// libsandbox private API.
|
|
|
|
|
extern "C" {
|
|
|
|
|
extern const char* APP_SANDBOX_READ;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -22,6 +24,7 @@ char* sandbox_extension_issue_file(const char* type,
|
2023-11-21 10:53:21 -08:00
|
|
|
const char* path,
|
|
|
|
|
uint32_t flags);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
namespace sandbox {
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -50,7 +53,11 @@ std::unique_ptr<SeatbeltExtension> SeatbeltExtension::FromToken(
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
bool SeatbeltExtension::Consume() {
|
|
|
|
|
DCHECK(!token_.empty());
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
handle_ = sandbox_extension_consume(token_.c_str());
|
|
|
|
|
+#else
|
|
|
|
|
+ handle_ = -1;
|
|
|
|
|
+#endif
|
|
|
|
|
return handle_ > 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -62,7 +69,11 @@ bool SeatbeltExtension::ConsumePermanently() {
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SeatbeltExtension::Revoke() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
int rv = sandbox_extension_release(handle_);
|
|
|
|
|
+#else
|
|
|
|
|
+ int rv = -1;
|
|
|
|
|
+#endif
|
|
|
|
|
handle_ = 0;
|
|
|
|
|
token_.clear();
|
|
|
|
|
return rv == 0;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -80,12 +91,14 @@ SeatbeltExtension::SeatbeltExtension(const std::string& token)
|
2023-11-21 10:53:21 -08:00
|
|
|
char* SeatbeltExtension::IssueToken(SeatbeltExtension::Type type,
|
|
|
|
|
const std::string& resource) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
case FILE_READ:
|
|
|
|
|
return sandbox_extension_issue_file(APP_SANDBOX_READ, resource.c_str(),
|
|
|
|
|
0);
|
|
|
|
|
case FILE_READ_WRITE:
|
|
|
|
|
return sandbox_extension_issue_file(APP_SANDBOX_READ_WRITE,
|
|
|
|
|
resource.c_str(), 0);
|
|
|
|
|
+#endif
|
|
|
|
|
default:
|
2024-09-30 14:54:44 +02:00
|
|
|
NOTREACHED();
|
|
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
|
2024-09-17 01:38:56 -07:00
|
|
|
index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228016389af 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/sandbox/mac/system_services.cc
|
|
|
|
|
+++ b/sandbox/mac/system_services.cc
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -8,7 +8,9 @@
|
|
|
|
|
#include <CoreFoundation/CoreFoundation.h>
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
#include "base/apple/osstatus_logging.h"
|
2024-09-17 01:38:56 -07:00
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
|
|
|
|
|
void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -19,10 +21,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
2023-11-21 10:53:21 -08:00
|
|
|
// https://github.com/WebKit/WebKit/blob/24aaedc770d192d03a07ba4a71727274aaa8fc07/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm#L840
|
|
|
|
|
void _CSCheckFixDisable();
|
|
|
|
|
} // extern "C"
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
namespace sandbox {
|
|
|
|
|
|
|
|
|
|
void DisableLaunchServices() {
|
|
|
|
|
+ #if !IS_MAS_BUILD()
|
|
|
|
|
// Allow the process to continue without a LaunchServices ASN. The
|
|
|
|
|
// INIT_Process function in HIServices will abort if it cannot connect to
|
|
|
|
|
// launchservicesd to get an ASN. By setting this flag, HIServices skips
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -36,10 +40,13 @@ void DisableLaunchServices() {
|
2023-11-21 10:53:21 -08:00
|
|
|
0, ^bool(CFDictionaryRef options) {
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
+ #endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DisableCoreServicesCheckFix() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
_CSCheckFixDisable();
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace sandbox
|
|
|
|
|
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
index 96b487da179dd60e325194335cb091b36ec08d35..33efac95559d5ae91a377077b8df357dfa5b7edc 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/third_party/blink/renderer/core/BUILD.gn
|
|
|
|
|
+++ b/third_party/blink/renderer/core/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -428,6 +428,7 @@ component("core") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/gfx/geometry",
|
|
|
|
|
"//ui/gfx/geometry:geometry_skia",
|
|
|
|
|
"//ui/strings",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
|
|
|
|
]
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
if (is_mac) {
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni
|
2025-06-16 12:46:06 -05:00
|
|
|
index c771cee7be34f36521de34ef893ee578b648a8c8..b0bd447b848bfdb7a9ff9cd98ba95574cb846cc2 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/third_party/blink/renderer/core/editing/build.gni
|
|
|
|
|
+++ b/third_party/blink/renderer/core/editing/build.gni
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -362,10 +362,14 @@ blink_core_sources_editing = [
|
2023-11-21 10:53:21 -08:00
|
|
|
if (is_mac) {
|
|
|
|
|
blink_core_sources_editing += [
|
|
|
|
|
"commands/smart_replace_cf.cc",
|
|
|
|
|
- "kill_ring_mac.mm",
|
|
|
|
|
"substring_util.h",
|
|
|
|
|
"substring_util.mm",
|
|
|
|
|
]
|
|
|
|
|
+ if (is_mas_build) {
|
|
|
|
|
+ blink_core_sources_editing += [ "kill_ring_mac.mm" ]
|
|
|
|
|
+ } else {
|
|
|
|
|
+ blink_core_sources_editing += [ "kill_ring_none.cc" ]
|
|
|
|
|
+ }
|
|
|
|
|
} else {
|
|
|
|
|
blink_core_sources_editing += [ "kill_ring_none.cc" ]
|
|
|
|
|
}
|
|
|
|
|
diff --git a/ui/accelerated_widget_mac/BUILD.gn b/ui/accelerated_widget_mac/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 0f8a6f75b7f01029adc2f5fd23559bacce19cf72..cf66c2f4f02a8e21cc83c3b7389fc5156bcd93ba 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/accelerated_widget_mac/BUILD.gn
|
|
|
|
|
+++ b/ui/accelerated_widget_mac/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -83,6 +83,7 @@ component("accelerated_widget_mac") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/gfx",
|
|
|
|
|
"//ui/gfx/geometry",
|
|
|
|
|
"//ui/gl",
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
2024-09-17 01:38:56 -07:00
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2024-04-15 18:10:32 -04:00
|
|
|
diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
|
2025-07-22 16:09:47 -07:00
|
|
|
index ce6a061b57cce101c103527dbbbe5ed47b2ecaf8..616922c34e1f3bc50584c0417129b78e3ff651d1 100644
|
2024-04-15 18:10:32 -04:00
|
|
|
--- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
|
|
|
|
|
+++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h"
|
|
|
|
|
#include "ui/gfx/ca_layer_result.h"
|
|
|
|
|
@@ -14,7 +15,9 @@
|
2024-04-15 18:10:32 -04:00
|
|
|
#include "ui/gl/gl_surface.h"
|
|
|
|
|
#include "ui/gl/presenter.h"
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
@class CAContext;
|
|
|
|
|
+#endif
|
|
|
|
|
@class CALayer;
|
2025-04-24 17:18:38 +09:00
|
|
|
@protocol MTLDevice;
|
2024-04-15 18:10:32 -04:00
|
|
|
|
2025-07-22 16:09:47 -07:00
|
|
|
@@ -113,7 +116,9 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator {
|
2024-04-15 18:10:32 -04:00
|
|
|
// both the current tree and the pending trees.
|
|
|
|
|
size_t presented_ca_layer_trees_max_length_ = 2;
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
CAContext* __strong ca_context_;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// The root CALayer to display the current frame. This does not change
|
|
|
|
|
// over the lifetime of the object.
|
|
|
|
|
diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index e1b1b0965669cae54565719f9ad6ba808416c2f7..ef7e6fd0d23626db303199ae5c79c8fd55ebba71 100644
|
2024-04-15 18:10:32 -04:00
|
|
|
--- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
|
|
|
|
|
+++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -10,6 +10,7 @@
|
|
|
|
|
#include "base/mac/mac_util.h"
|
|
|
|
|
#include "base/task/single_thread_task_runner.h"
|
|
|
|
|
#include "base/trace_event/trace_event.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "ui/base/cocoa/animation_utils.h"
|
|
|
|
|
#include "ui/base/cocoa/remote_layer_api.h"
|
|
|
|
|
#include "ui/gfx/ca_layer_params.h"
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -31,6 +32,7 @@
|
2025-02-06 15:30:54 -05:00
|
|
|
allow_av_sample_buffer_display_layer),
|
2025-04-24 17:18:38 +09:00
|
|
|
buffer_presented_callback_(buffer_presented_callback),
|
|
|
|
|
metal_device_(metal_device) {
|
2024-04-15 18:10:32 -04:00
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (allow_remote_layers_) {
|
|
|
|
|
root_ca_layer_ = [[CALayer alloc] init];
|
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -59,6 +61,7 @@
|
2024-04-15 18:10:32 -04:00
|
|
|
#endif
|
|
|
|
|
ca_context_.layer = root_ca_layer_;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CALayerTreeCoordinator::~CALayerTreeCoordinator() = default;
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -162,9 +165,13 @@
|
2024-04-15 18:10:32 -04:00
|
|
|
TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD,
|
|
|
|
|
"GLImpl", static_cast<int>(gl::GetGLImplementation()),
|
|
|
|
|
"width", pixel_size_.width());
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (allow_remote_layers_) {
|
|
|
|
|
params.ca_context_id = [ca_context_ contextId];
|
|
|
|
|
} else {
|
|
|
|
|
+#else
|
|
|
|
|
+ if (true) {
|
|
|
|
|
+#endif
|
|
|
|
|
IOSurfaceRef io_surface = frame->layer_tree->GetContentIOSurface();
|
|
|
|
|
if (io_surface) {
|
|
|
|
|
DCHECK(!allow_remote_layers_);
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
index dcf493d62990018040a3f84b6f875af737bd2214..3d1c4dcc9ee0bbfdac15f40d9c74e9f342a59e39 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
|
|
|
|
+++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -12,6 +12,7 @@
|
|
|
|
|
#include "base/mac/mac_util.h"
|
|
|
|
|
#include "base/trace_event/trace_event.h"
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "ui/base/cocoa/animation_utils.h"
|
|
|
|
|
#include "ui/base/cocoa/remote_layer_api.h"
|
|
|
|
|
#include "ui/gfx/geometry/dip_util.h"
|
|
|
|
|
@@ -121,6 +122,7 @@ - (void)setContentsChanged;
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Early-out if the remote layer has not changed.
|
|
|
|
|
if (remote_layer_.contextId == ca_context_id) {
|
|
|
|
|
return;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -150,6 +152,9 @@ - (void)setContentsChanged;
|
2023-11-21 10:53:21 -08:00
|
|
|
[io_surface_layer_ removeFromSuperlayer];
|
|
|
|
|
io_surface_layer_ = nil;
|
|
|
|
|
}
|
|
|
|
|
+#else
|
|
|
|
|
+ NOTREACHED() << "Remote layer is being used in MAS build";
|
|
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DisplayCALayerTree::GotIOSurfaceFrame(
|
|
|
|
|
diff --git a/ui/accessibility/platform/BUILD.gn b/ui/accessibility/platform/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
index 54d483d6b3f1a56573e21b1f873b8dee8fc25a0f..33bc8c9ef097a907060ed347dca2ad46b6d081f5 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/accessibility/platform/BUILD.gn
|
|
|
|
|
+++ b/ui/accessibility/platform/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -299,6 +299,7 @@ component("platform") {
|
2024-08-02 09:02:11 -05:00
|
|
|
"AppKit.framework",
|
|
|
|
|
"Foundation.framework",
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
2024-06-07 17:18:35 -04:00
|
|
|
if (is_ios) {
|
2024-09-17 18:12:11 -07:00
|
|
|
diff --git a/ui/accessibility/platform/browser_accessibility_manager_mac.mm b/ui/accessibility/platform/browser_accessibility_manager_mac.mm
|
2025-09-08 17:08:42 -04:00
|
|
|
index 8ef5c8c7ac9a555fe41e6146997833ae43164951..4c17f1d29dac780195e07bcdb7e12a8fdd3f2130 100644
|
2024-09-17 18:12:11 -07:00
|
|
|
--- a/ui/accessibility/platform/browser_accessibility_manager_mac.mm
|
|
|
|
|
+++ b/ui/accessibility/platform/browser_accessibility_manager_mac.mm
|
2025-04-22 15:53:29 -04:00
|
|
|
@@ -14,6 +14,7 @@
|
2024-09-17 18:12:11 -07:00
|
|
|
#include "base/task/single_thread_task_runner.h"
|
|
|
|
|
#include "base/task/task_traits.h"
|
|
|
|
|
#include "base/time/time.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
2025-01-10 10:52:34 -06:00
|
|
|
#include "ui/accessibility/accessibility_features.h"
|
2024-09-17 18:12:11 -07:00
|
|
|
#include "ui/accessibility/ax_role_properties.h"
|
2025-07-14 13:42:37 -07:00
|
|
|
@@ -22,7 +23,9 @@
|
2024-09-17 18:12:11 -07:00
|
|
|
#include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
|
|
|
|
|
#import "ui/accessibility/platform/browser_accessibility_cocoa.h"
|
|
|
|
|
#import "ui/accessibility/platform/browser_accessibility_mac.h"
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
#include "ui/base/cocoa/remote_accessibility_api.h"
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
2025-07-14 13:42:37 -07:00
|
|
|
@@ -231,6 +234,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2024-09-17 18:12:11 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
BrowserAccessibilityManager* root_manager = GetManagerForRootFrame();
|
|
|
|
|
if (root_manager) {
|
|
|
|
|
BrowserAccessibilityManagerMac* root_manager_mac =
|
2025-07-14 13:42:37 -07:00
|
|
|
@@ -253,6 +257,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2024-09-17 18:12:11 -07:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Use native VoiceOver support for live regions.
|
|
|
|
|
BrowserAccessibilityCocoa* retained_node = native_node;
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -696,6 +701,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2024-09-17 18:12:11 -07:00
|
|
|
return window == [NSApp accessibilityFocusedWindow];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// TODO(accessibility): We need a solution to the problem described below.
|
|
|
|
|
// If the window is NSAccessibilityRemoteUIElement, there are some challenges:
|
|
|
|
|
// 1. NSApp is the browser which spawned the PWA, and what it considers the
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -724,6 +730,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2024-09-17 18:12:11 -07:00
|
|
|
if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/ui/accessibility/platform/inspect/ax_transform_mac.mm b/ui/accessibility/platform/inspect/ax_transform_mac.mm
|
2025-04-22 15:53:29 -04:00
|
|
|
index 6846060ef9622d8fc8d1d6c8da16e2f1b785e6bd..05c22db87e882b246bd7034e027cf1495376b6c6 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/accessibility/platform/inspect/ax_transform_mac.mm
|
|
|
|
|
+++ b/ui/accessibility/platform/inspect/ax_transform_mac.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -11,6 +11,7 @@
|
|
|
|
|
|
|
|
|
|
#include "base/apple/foundation_util.h"
|
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "ui/accessibility/ax_range.h"
|
|
|
|
|
#include "ui/accessibility/platform/ax_platform_node.h"
|
|
|
|
|
#include "ui/accessibility/platform/ax_platform_node_cocoa.h"
|
|
|
|
|
@@ -111,6 +112,7 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// AXTextMarker
|
|
|
|
|
if (IsAXTextMarker(value)) {
|
|
|
|
|
return AXTextMarkerToBaseValue(value, indexer);
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -120,6 +122,7 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
if (IsAXTextMarkerRange(value)) {
|
|
|
|
|
return AXTextMarkerRangeToBaseValue(value, indexer);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Accessible object
|
|
|
|
|
if (AXElementWrapper::IsValidElement(value)) {
|
|
|
|
|
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
index 1428a0aa8d233062990e825050e71d3e3b6dd6f0..009d3446ae976150b25c92ee50590f0926956bca 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/base/BUILD.gn
|
|
|
|
|
+++ b/ui/base/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -355,6 +355,13 @@ component("base") {
|
2024-11-04 09:10:00 -05:00
|
|
|
]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (is_mas_build) {
|
|
|
|
|
+ sources -= [
|
|
|
|
|
+ "cocoa/remote_accessibility_api.h",
|
|
|
|
|
+ "cocoa/remote_accessibility_api.mm",
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
if (is_ios) {
|
|
|
|
|
sources += [
|
2024-11-14 18:18:11 +01:00
|
|
|
"device_form_factor_ios.mm",
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -503,6 +510,12 @@ component("base") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//url",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
+ if (is_mac) {
|
|
|
|
|
+ deps += [
|
|
|
|
|
+ "//electron/build/config:generate_mas_config"
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
if (is_debug || dcheck_always_on) {
|
|
|
|
|
deps += [ "//third_party/re2" ]
|
|
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h
|
2024-09-17 01:38:56 -07:00
|
|
|
index 3182458838aa96d34911280ab4c6c3aa4aa22d6d..6dc85c366b7e61c8bd0302e501c3223a19223313 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/base/cocoa/remote_accessibility_api.h
|
|
|
|
|
+++ b/ui/base/cocoa/remote_accessibility_api.h
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -10,9 +10,12 @@
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "base/component_export.h"
|
|
|
|
|
+#include "electron/mas.h"
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
// NSAccessibilityRemoteUIElement is a private class in AppKit.
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
+
|
|
|
|
|
@interface NSAccessibilityRemoteUIElement : NSObject
|
|
|
|
|
+ (void)setRemoteUIApp:(BOOL)flag;
|
|
|
|
|
+ (BOOL)isRemoteUIApp;
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -38,4 +41,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAccessibility {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
} // namespace ui
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
#endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
|
|
|
|
|
diff --git a/ui/base/cocoa/remote_layer_api.h b/ui/base/cocoa/remote_layer_api.h
|
2024-09-17 01:38:56 -07:00
|
|
|
index 59dc2f82214cfd883b6ebef3b0fb25af6387a9cd..912c5252d1b30d943a1552739b9eef9a8eae2d7a 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/base/cocoa/remote_layer_api.h
|
|
|
|
|
+++ b/ui/base/cocoa/remote_layer_api.h
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -9,6 +9,7 @@
|
|
|
|
|
|
|
|
|
|
#include "base/component_export.h"
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
|
|
|
|
|
#if defined(__OBJC__)
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
@@ -17,6 +18,7 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// The CGSConnectionID is used to create the CAContext in the process that is
|
|
|
|
|
// going to share the CALayers that it is rendering to another process to
|
|
|
|
|
// display.
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -68,6 +70,8 @@ extern NSString* const kCAContextIgnoresHitTest;
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
#endif // __OBJC__
|
|
|
|
|
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
+
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
|
|
// This function will check if all of the interfaces listed above are supported
|
|
|
|
|
diff --git a/ui/base/cocoa/remote_layer_api.mm b/ui/base/cocoa/remote_layer_api.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index 93e90c4eba9bc9b93d68e834eb6baabeb2d0ecf0..1b90f41d05f847a94adf2f4da827b1d0143b7bcf 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/base/cocoa/remote_layer_api.mm
|
|
|
|
|
+++ b/ui/base/cocoa/remote_layer_api.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -5,18 +5,22 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "ui/base/cocoa/remote_layer_api.h"
|
|
|
|
|
|
|
|
|
|
#include "base/feature_list.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
|
|
|
|
|
#include <objc/runtime.h>
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
namespace {
|
|
|
|
|
// Control use of cross-process CALayers to display content directly from the
|
|
|
|
|
// GPU process on Mac.
|
2025-09-24 11:56:54 -04:00
|
|
|
BASE_FEATURE(kRemoteCoreAnimationAPI, base::FEATURE_ENABLED_BY_DEFAULT);
|
2023-11-21 10:53:21 -08:00
|
|
|
} // namespace
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
bool RemoteLayerAPISupported() {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (!base::FeatureList::IsEnabled(kRemoteCoreAnimationAPI))
|
|
|
|
|
return false;
|
|
|
|
|
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -53,6 +57,9 @@ bool RemoteLayerAPISupported() {
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
// If everything is there, we should be able to use the API.
|
|
|
|
|
return true;
|
|
|
|
|
+#else
|
|
|
|
|
+ return false;
|
|
|
|
|
+#endif // MAS_BUILD
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
diff --git a/ui/display/BUILD.gn b/ui/display/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index ca9b2b6f9a4e070d2fd40a6fec672d612ff757e0..87eee402eb38270690b798b67a368e113008d8cc 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/display/BUILD.gn
|
|
|
|
|
+++ b/ui/display/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -131,6 +131,12 @@ component("display") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/gfx/geometry",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
+ if (is_mac) {
|
|
|
|
|
+ deps += [
|
|
|
|
|
+ "//electron/build/config:generate_mas_config"
|
2023-11-21 10:53:21 -08:00
|
|
|
+ ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
if (is_ios) {
|
|
|
|
|
deps += [ "//build:ios_buildflags" ]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index a76d09dd2a2a71d0b8397f4abe30fe7bbb6e513d..eba69f4c6e72b36e799ce902cdffd2dd1f2387d6 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/display/mac/screen_mac.mm
|
|
|
|
|
+++ b/ui/display/mac/screen_mac.mm
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -33,6 +33,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "base/trace_event/trace_event.h"
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
|
#include "components/device_event_log/device_event_log.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "ui/display/display.h"
|
|
|
|
|
#include "ui/display/display_change_notifier.h"
|
2025-05-13 14:51:20 -04:00
|
|
|
#include "ui/display/mac/screen_mac_headless.h"
|
2025-06-26 00:12:49 +09:00
|
|
|
@@ -182,7 +183,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
|
2023-11-21 10:53:21 -08:00
|
|
|
display.set_color_depth(Display::kDefaultBitsPerPixel);
|
|
|
|
|
display.set_depth_per_component(Display::kDefaultBitsPerComponent);
|
|
|
|
|
}
|
|
|
|
|
+#if IS_MAS_BUILD()
|
|
|
|
|
+ // This is equivalent to the CGDisplayUsesForceToGray() API as at 2018-08-06,
|
|
|
|
|
+ // but avoids usage of the private API.
|
|
|
|
|
+ CFStringRef app = CFSTR("com.apple.CoreGraphics");
|
|
|
|
|
+ CFStringRef key = CFSTR("DisplayUseForcedGray");
|
|
|
|
|
+ Boolean key_valid = false;
|
|
|
|
|
+ display.set_is_monochrome(
|
|
|
|
|
+ CFPreferencesGetAppBooleanValue(key, app, &key_valid));
|
|
|
|
|
+#else
|
|
|
|
|
display.set_is_monochrome(CGDisplayUsesForceToGray());
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Query the display's refresh rate.
|
2025-06-16 12:46:06 -05:00
|
|
|
double refresh_rate = 1.0 / screen.minimumRefreshInterval;
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 300079ed71ff990396d419ed55755f128dda6695..464682fd86764adbef54faaa5894a55be87ee5cf 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/gfx/BUILD.gn
|
|
|
|
|
+++ b/ui/gfx/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -335,6 +335,12 @@ component("gfx") {
|
2024-09-17 01:38:56 -07:00
|
|
|
"//ui/base:ui_data_pack",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
+ if (is_mac) {
|
|
|
|
|
+ deps += [
|
|
|
|
|
+ "//electron/build/config:generate_mas_config"
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
if (!is_apple) {
|
2023-11-21 10:53:21 -08:00
|
|
|
sources += [
|
2024-09-17 01:38:56 -07:00
|
|
|
"platform_font_skia.cc",
|
2023-11-21 10:53:21 -08:00
|
|
|
diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c5013ef678a 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/gfx/platform_font_mac.mm
|
|
|
|
|
+++ b/ui/gfx/platform_font_mac.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -19,6 +19,7 @@
|
|
|
|
|
#include "base/numerics/safe_conversions.h"
|
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
|
#include "base/strings/utf_string_conversions.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "third_party/skia/include/ports/SkTypeface_mac.h"
|
|
|
|
|
#include "ui/gfx/canvas.h"
|
|
|
|
|
#include "ui/gfx/font.h"
|
|
|
|
|
@@ -28,9 +29,11 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
|
|
|
|
|
using Weight = Font::Weight;
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
extern "C" {
|
|
|
|
|
bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
2024-09-17 18:12:11 -07:00
|
|
|
@@ -250,7 +253,13 @@ CTFontRef SystemFontForConstructorOfType(
|
2023-11-21 10:53:21 -08:00
|
|
|
// TODO(avi, etienneb): Figure out this font stuff.
|
|
|
|
|
base::apple::ScopedCFTypeRef<CTFontDescriptorRef> descriptor(
|
|
|
|
|
CTFontCopyFontDescriptor(font));
|
|
|
|
|
+#if IS_MAS_BUILD()
|
|
|
|
|
+ CFNumberRef priority = (CFNumberRef)CTFontDescriptorCopyAttribute(descriptor.get(), (CFStringRef)kCTFontPriorityAttribute);
|
|
|
|
|
+ SInt64 v;
|
|
|
|
|
+ if (CFNumberGetValue(priority, kCFNumberSInt64Type, &v) && v == kCTFontPrioritySystem) {
|
|
|
|
|
+#else
|
|
|
|
|
if (CTFontDescriptorIsSystemUIFont(descriptor.get())) {
|
|
|
|
|
+#endif
|
|
|
|
|
// Assume it's the standard system font. The fact that this much is known is
|
|
|
|
|
// enough.
|
|
|
|
|
return PlatformFontMac::SystemFontType::kGeneral;
|
|
|
|
|
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index f4651d57e9f1ac76c0e93ce3859f4169cd689200..d07439f78ac914d6daeb54dbc5beea80f1fb11bd 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/views/BUILD.gn
|
|
|
|
|
+++ b/ui/views/BUILD.gn
|
2025-09-08 17:08:42 -04:00
|
|
|
@@ -720,6 +720,8 @@ component("views") {
|
2023-11-21 10:53:21 -08:00
|
|
|
"IOSurface.framework",
|
|
|
|
|
"QuartzCore.framework",
|
|
|
|
|
]
|
2024-09-25 06:19:39 -05:00
|
|
|
+
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_win) {
|
2025-09-24 11:56:54 -04:00
|
|
|
@@ -1150,6 +1152,8 @@ source_set("test_support") {
|
2024-09-25 06:19:39 -05:00
|
|
|
"//ui/base/mojom:ui_base_types",
|
2023-11-21 10:53:21 -08:00
|
|
|
]
|
|
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
2023-11-21 10:53:21 -08:00
|
|
|
+
|
|
|
|
|
if (is_win) {
|
|
|
|
|
sources += [
|
|
|
|
|
"test/desktop_window_tree_host_win_test_api.cc",
|
|
|
|
|
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
2025-08-06 20:14:23 -04:00
|
|
|
index 4cc9db3ae1ef2443b1ecf923c9c572b7d0e85662..f7bf6a6bb63f9c38cc21c03da1c884d6bee8ab9a 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
|
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -19,6 +19,7 @@
|
2024-09-17 01:38:56 -07:00
|
|
|
#include "components/remote_cocoa/browser/scoped_cg_window_id.h"
|
|
|
|
|
#include "components/remote_cocoa/common/native_widget_ns_window.mojom.h"
|
|
|
|
|
#include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/associated_remote.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -34,7 +35,9 @@
|
2023-11-21 10:53:21 -08:00
|
|
|
#include "ui/views/window/dialog_observer.h"
|
|
|
|
|
|
|
|
|
|
@class NativeWidgetMacNSWindow;
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
@class NSAccessibilityRemoteUIElement;
|
|
|
|
|
+#endif
|
|
|
|
|
@class NSView;
|
|
|
|
|
|
|
|
|
|
namespace remote_cocoa {
|
2025-08-06 20:14:23 -04:00
|
|
|
@@ -502,10 +505,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
2023-11-21 10:53:21 -08:00
|
|
|
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
|
|
|
|
|
remote_ns_window_remote_;
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
// Remote accessibility objects corresponding to the NSWindow and its root
|
|
|
|
|
// NSView.
|
|
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
|
|
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_view_accessible_;
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
// Used to force the NSApplication's focused accessibility element to be the
|
|
|
|
|
// views::Views accessibility tree when the NSView for this is focused.
|
|
|
|
|
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
2025-09-24 11:56:54 -04:00
|
|
|
index 5fc62f87b842f6aca7082b3957f2adb9f44e2114..7befaf18ae9c922ccd8d36a006b9105cb55b1a32 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
|
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -21,6 +21,7 @@
|
|
|
|
|
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
|
|
|
|
|
#include "components/remote_cocoa/browser/ns_view_ids.h"
|
|
|
|
|
#include "components/remote_cocoa/browser/window.h"
|
|
|
|
|
+#include "electron/mas.h"
|
|
|
|
|
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
|
|
|
|
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
|
|
|
|
|
#include "ui/accessibility/accessibility_features.h"
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -359,8 +360,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2025-01-10 10:52:34 -06:00
|
|
|
if (in_process_ns_window_bridge_) {
|
2025-04-22 15:53:29 -04:00
|
|
|
return gfx::NativeViewAccessible(in_process_ns_window_bridge_->ns_view());
|
2025-01-10 10:52:34 -06:00
|
|
|
}
|
2023-11-21 10:53:21 -08:00
|
|
|
+#if !IS_MAS_BUILD()
|
2025-04-22 15:53:29 -04:00
|
|
|
return gfx::NativeViewAccessible(
|
|
|
|
|
(id<NSAccessibility>)remote_view_accessible_);
|
2023-11-21 10:53:21 -08:00
|
|
|
+#else
|
2025-04-22 15:53:29 -04:00
|
|
|
+ return {};
|
2023-11-21 10:53:21 -08:00
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfx::NativeViewAccessible
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -376,8 +381,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2025-04-22 15:53:29 -04:00
|
|
|
[in_process_ns_window_bridge_->ns_view() window]);
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
2025-04-22 15:53:29 -04:00
|
|
|
return gfx::NativeViewAccessible(
|
|
|
|
|
(id<NSAccessibility>)remote_window_accessible_);
|
2023-11-21 10:53:21 -08:00
|
|
|
+#else
|
2025-04-22 15:53:29 -04:00
|
|
|
+ return {};
|
2023-11-21 10:53:21 -08:00
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
remote_cocoa::mojom::NativeWidgetNSWindow*
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -1439,9 +1448,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2024-04-15 18:10:32 -04:00
|
|
|
// for PWAs. However this breaks accessibility on in-process windows,
|
|
|
|
|
// so set it back to NO when a local window gains focus. See
|
|
|
|
|
// https://crbug.com/41485830.
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
if (is_key && features::IsAccessibilityRemoteUIAppEnabled()) {
|
|
|
|
|
[NSAccessibilityRemoteUIElement setRemoteUIApp:!!application_host_];
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
// Explicitly set the keyboard accessibility state on regaining key
|
|
|
|
|
// window status.
|
2025-01-10 10:52:34 -06:00
|
|
|
if (is_key && is_content_first_responder) {
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -1582,17 +1593,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2023-11-21 10:53:21 -08:00
|
|
|
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
|
|
|
|
const std::vector<uint8_t>& window_token,
|
|
|
|
|
const std::vector<uint8_t>& view_token) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
remote_window_accessible_ =
|
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
|
|
|
remote_view_accessible_ =
|
2024-04-15 18:10:32 -04:00
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(view_token);
|
|
|
|
|
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_];
|
|
|
|
|
[remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_];
|
2023-11-21 10:53:21 -08:00
|
|
|
+#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
|
2024-02-29 10:31:13 +01:00
|
|
|
base::ProcessId* pid,
|
2023-11-21 10:53:21 -08:00
|
|
|
std::vector<uint8_t>* token) {
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
|
*pid = getpid();
|
|
|
|
|
id element_id = GetNativeViewAccessible();
|
|
|
|
|
|
2025-06-16 12:46:06 -05:00
|
|
|
@@ -1605,6 +1619,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2023-11-21 10:53:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
|
|
|
|
+#endif
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/ui/views/controls/webview/BUILD.gn b/ui/views/controls/webview/BUILD.gn
|
2025-09-24 11:56:54 -04:00
|
|
|
index 50bb38a38dca67f9f393c48efe123f7dd7ca2594..2062e479581d63325de3c3398844acca0601c86c 100644
|
2023-11-21 10:53:21 -08:00
|
|
|
--- a/ui/views/controls/webview/BUILD.gn
|
|
|
|
|
+++ b/ui/views/controls/webview/BUILD.gn
|
2024-09-17 01:38:56 -07:00
|
|
|
@@ -46,6 +46,12 @@ component("webview") {
|
|
|
|
|
"//url",
|
|
|
|
|
]
|
2023-11-21 10:53:21 -08:00
|
|
|
|
2024-09-17 01:38:56 -07:00
|
|
|
+ if (is_mac) {
|
|
|
|
|
+ deps += [
|
|
|
|
|
+ "//electron/build/config:generate_mas_config",
|
2023-11-21 10:53:21 -08:00
|
|
|
+ ]
|
2024-09-17 01:38:56 -07:00
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
public_deps = [
|
|
|
|
|
"//base",
|
|
|
|
|
"//content/public/browser",
|