mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
* chore: bump chromium in DEPS to 149.0.7815.0 * chore: update patches (trivial only) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * 7747370: [Extensions] Move manifest_url_handlers.{h,cc} Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7747370 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore: node ./script/gen-libc++-filenames.js * gfx::CALayerParams: Make move-only, add fence mach port | https://chromium-review.googlesource.com/c/chromium/src/+/7790009 * fix: preserve renderer stdio behavior on Windows https://chromium-review.googlesource.com/c/chromium/src/+/7665803 now opens CONOUT$ with rw permissions for proper TTY detection. That makes libuv classify inherited console handles as UV_TTY, so Node now exposes process.stdout.isTTY as true in renderer processes. Electron's renderer treats stdout/stderr as non-TTY and our spec expects process.stdout.isTTY to be undefined. This PR preserves that by masking isTTY on process.stdout and process.stderr in the Windows renderer init path, but keeps the underlying streams rw for #50268. Xref: https://github.com/electron/electron/pull/50268 Co-authored-by: GitHub Copilot <copilot@github.com> * chore: bump chromium in DEPS to 149.0.7817.0 * chore: update patches (trivial only) * Reland "Migrate ProcessMap to use ChildProcessId" | https://chromium-review.googlesource.com/c/chromium/src/+/7793314 * chore: node ./script/gen-libc++-filenames.js * fixup! fix: preserve renderer stdio behavior on Windows * test: use code review suggestions --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: chromium-roller[bot] <chromium-roller[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: GitHub Copilot <copilot@github.com>
2514 lines
88 KiB
Diff
2514 lines
88 KiB
Diff
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
|
|
* CGSSetWindowCaptureExcludeShape
|
|
* CGRegionCreateWithRect
|
|
* CTFontCopyVariationAxesInternal
|
|
* AudioDeviceDuck
|
|
* NSNextStepFrame
|
|
* NSThemeFrame
|
|
* NSTextInputReplacementRangeAttributeName
|
|
* _toolbarView
|
|
* _menuImpl
|
|
* _removeFromGroups:
|
|
* _isConsideredOpenForPersistentState
|
|
* _boundsIfOpen
|
|
* _resizeDirectionForMouseLocation:
|
|
* NSAppendToKillRing
|
|
* kCFBundleNumericVersionKey
|
|
* __NSNewKillRingSequence
|
|
* __NSInitializeKillRing
|
|
* NSYankFromKillRing
|
|
* NSSetKillRingToYankedState
|
|
* 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
|
|
index ee3e6b431434cca3917887019ab39751af14555d..e1ab1700ce6fa2a134e632bcb26ed3e54ef2e9f2 100644
|
|
--- a/base/BUILD.gn
|
|
+++ b/base/BUILD.gn
|
|
@@ -1124,6 +1124,7 @@ component("base") {
|
|
"//build:ios_buildflags",
|
|
"//build/config/compiler:compiler_buildflags",
|
|
"//third_party/modp_b64",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
|
|
# Used by metrics/crc32
|
|
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn
|
|
index f2e33bd815cb93747e20d6591068dc7d1e1789a8..51a4eb83881d83122408787a4f002a4c114ccaec 100644
|
|
--- a/base/allocator/BUILD.gn
|
|
+++ b/base/allocator/BUILD.gn
|
|
@@ -29,6 +29,7 @@ if (is_apple) {
|
|
deps = [
|
|
":buildflags",
|
|
"//base/allocator/partition_allocator:buildflags",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
}
|
|
}
|
|
diff --git a/base/allocator/early_zone_registration_apple.cc b/base/allocator/early_zone_registration_apple.cc
|
|
index 416e541436d201aabca26cdbf7e8477103bd014c..8c5f92b03d67e5f0587b0e94209690611e3b082a 100644
|
|
--- a/base/allocator/early_zone_registration_apple.cc
|
|
+++ b/base/allocator/early_zone_registration_apple.cc
|
|
@@ -197,15 +197,33 @@ void EarlyMallocZoneRegistration() {
|
|
// a duplicate even when a binary copy of this code exists.
|
|
if (allocator_shim::IsZoneAlreadyRegistered(
|
|
allocator_shim::kDelegatingZoneName)) {
|
|
+#if !IS_MAS_BUILD()
|
|
abort_report_np(
|
|
"The delegating default zone has unexpectedly already been "
|
|
"registered.");
|
|
+#else
|
|
+#pragma clang diagnostic push
|
|
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
|
+ os_log_fault(OS_LOG_DEFAULT, "The delegating default zone "
|
|
+ "has unexpectedly already been registered.");
|
|
+#pragma clang diagnostic pop
|
|
+ abort();
|
|
+#endif
|
|
}
|
|
if (allocator_shim::IsZoneAlreadyRegistered(
|
|
allocator_shim::kPartitionAllocZoneName)) {
|
|
+#if !IS_MAS_BUILD()
|
|
abort_report_np(
|
|
"The PartitionAlloc default zone has unexpectedly already been "
|
|
"registered.");
|
|
+#else
|
|
+#pragma clang diagnostic push
|
|
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
|
+ os_log_fault(OS_LOG_DEFAULT, "The PartitionAlloc default zone "
|
|
+ "has unexpectedly already been registered.");
|
|
+#pragma clang diagnostic pop
|
|
+ abort();
|
|
+#endif
|
|
}
|
|
|
|
// Register puts the new zone at the end, unregister swaps the new zone with
|
|
@@ -229,7 +247,16 @@ void EarlyMallocZoneRegistration() {
|
|
|
|
// Sanity check.
|
|
if (allocator_shim::GetDefaultMallocZoneOrDie() != &g_delegating_zone) {
|
|
+#if !IS_MAS_BUILD()
|
|
abort_report_np("Failed to install the delegating zone as default.");
|
|
+#else
|
|
+#pragma clang diagnostic push
|
|
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
|
+ os_log_fault(OS_LOG_DEFAULT, "Failed to install the delegating zone "
|
|
+ "as default.");
|
|
+#pragma clang diagnostic pop
|
|
+ abort();
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
diff --git a/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn b/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
|
|
index e6c0368e3a24073b6725d82b6d7ad6349e962b60..3ad2d66e43770c82206645e68bf4e50178c29b17 100644
|
|
--- a/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
|
|
+++ b/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
|
|
@@ -982,6 +982,7 @@ if (is_clang_or_gcc) {
|
|
":allocator_base",
|
|
":allocator_core",
|
|
":buildflags",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
}
|
|
} # if (is_clang_or_gcc)
|
|
diff --git a/base/allocator/partition_allocator/src/partition_alloc/shim/early_zone_registration_utils_apple.h b/base/allocator/partition_allocator/src/partition_alloc/shim/early_zone_registration_utils_apple.h
|
|
index 725b3d78c27d9621500d8193b0b4e45c6103cff0..cd3580fb4b7261b5d8e6ff691214e432c0170dc4 100644
|
|
--- a/base/allocator/partition_allocator/src/partition_alloc/shim/early_zone_registration_utils_apple.h
|
|
+++ b/base/allocator/partition_allocator/src/partition_alloc/shim/early_zone_registration_utils_apple.h
|
|
@@ -12,16 +12,21 @@
|
|
|
|
#include <mach/mach.h>
|
|
#include <malloc/malloc.h>
|
|
+#include <os/log.h>
|
|
|
|
#include <span>
|
|
#include <string_view>
|
|
|
|
+#include "electron/mas.h"
|
|
+
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
// abort_report_np() records the message in a special section that both the
|
|
// system CrashReporter and Crashpad collect in crash reports. See also in
|
|
// chrome_exe_main_mac.cc.
|
|
void abort_report_np(const char* fmt, ...);
|
|
} // extern "C"
|
|
+#endif
|
|
|
|
namespace allocator_shim {
|
|
|
|
@@ -34,7 +39,15 @@ inline std::span<malloc_zone_t*> GetMallocZonesOrDie() {
|
|
kern_return_t result = malloc_get_all_zones(
|
|
mach_task_self(), /*reader=*/nullptr, &zones, &zone_count);
|
|
if (result != KERN_SUCCESS) [[unlikely]] {
|
|
+#if !IS_MAS_BUILD()
|
|
abort_report_np("Cannot enumerate malloc zones.");
|
|
+#else
|
|
+#pragma clang diagnostic push
|
|
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
|
|
+ os_log_fault(OS_LOG_DEFAULT, "Cannot enumerate malloc zones.");
|
|
+#pragma clang diagnostic pop
|
|
+ abort();
|
|
+#endif
|
|
}
|
|
// This is not guaranteed by the C++ standard, but commonly satisfied.
|
|
// It must be safe to assume the same memory layout for arrays of two
|
|
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
|
|
index 4bf9a3c27e05c6635b2beb8e880b5b43dbed61b5..f328fbb49c45991f44a9c75325491d0873746b61 100644
|
|
--- a/base/enterprise_util_mac.mm
|
|
+++ b/base/enterprise_util_mac.mm
|
|
@@ -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() {
|
|
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) {
|
|
@@ -219,5 +228,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
|
|
|
return state;
|
|
}
|
|
+#endif
|
|
|
|
} // namespace base
|
|
diff --git a/base/mac/info_plist_data.mm b/base/mac/info_plist_data.mm
|
|
index 419a051968c58ae5a761708e4d942e8975c70852..a77032dd43f5fcbe29c54b622b34607fba09d350 100644
|
|
--- a/base/mac/info_plist_data.mm
|
|
+++ b/base/mac/info_plist_data.mm
|
|
@@ -11,15 +11,19 @@
|
|
#include "base/apple/bundle_locations.h"
|
|
#include "base/apple/foundation_util.h"
|
|
#include "base/containers/span.h"
|
|
+#include "electron/mas.h"
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
// Key used within CoreFoundation for loaded Info plists
|
|
extern const CFStringRef _kCFBundleNumericVersionKey;
|
|
}
|
|
+#endif
|
|
|
|
namespace base::mac {
|
|
|
|
std::vector<uint8_t> OuterBundleCachedInfoPlistData() {
|
|
+#if !IS_MAS_BUILD()
|
|
// NSBundle's info dictionary is used to ensure that any changes to Info.plist
|
|
// on disk due to pending updates do not result in a version of the data being
|
|
// used that doesn't match the code signature of the running app.
|
|
@@ -43,6 +47,9 @@
|
|
error:nullptr];
|
|
base::span<const uint8_t> span = apple::NSDataToSpan(data);
|
|
return {span.begin(), span.end()};
|
|
+#else
|
|
+ return {};
|
|
+#endif
|
|
}
|
|
|
|
} // namespace base::mac
|
|
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
|
index b63d58da9837ba4d1e4aff8f24f2cd977c5ed02d..49b4c0b69731386ef5a4b7dfb782aa8f4ae09cdd 100644
|
|
--- a/base/process/launch_mac.cc
|
|
+++ b/base/process/launch_mac.cc
|
|
@@ -84,6 +84,10 @@ int posix_spawnattr_set_csm_np(const posix_spawnattr_t*, uint32_t)
|
|
#include "base/threading/scoped_blocking_call.h"
|
|
#include "base/threading/thread_restrictions.h"
|
|
#include "base/trace_event/trace_event.h"
|
|
+#include "electron/mas.h"
|
|
+#if IS_MAS_BUILD()
|
|
+#include <sys/syscall.h>
|
|
+#endif
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
#include "base/apple/mach_port_rendezvous_mac.h"
|
|
@@ -92,9 +96,11 @@ int posix_spawnattr_set_csm_np(const posix_spawnattr_t*, uint32_t)
|
|
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);
|
|
@@ -171,13 +177,27 @@ class PosixSpawnFileActions {
|
|
|
|
#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
|
|
|
|
@@ -301,16 +321,16 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
|
file_actions.Inherit(STDERR_FILENO);
|
|
}
|
|
|
|
-#if BUILDFLAG(IS_MAC)
|
|
+#if !IS_MAS_BUILD()
|
|
if (options.disclaim_responsibility) {
|
|
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
|
}
|
|
+#endif
|
|
|
|
EnvironmentMap new_environment_map = options.environment;
|
|
+#if !IS_MAS_BUILD()
|
|
MachPortRendezvousServerMac::AddFeatureStateToEnvironment(
|
|
new_environment_map);
|
|
-#else
|
|
- const EnvironmentMap& new_environment_map = options.environment;
|
|
#endif
|
|
|
|
std::vector<char*> argv_cstr;
|
|
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 @@
|
|
|
|
#include "base/process/process_info.h"
|
|
|
|
+#include "electron/mas.h"
|
|
+
|
|
#import <AppKit/AppKit.h>
|
|
#include <unistd.h>
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
pid_t responsibility_get_pid_responsible_for_pid(pid_t);
|
|
}
|
|
+#endif
|
|
|
|
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
|
|
|
|
namespace base {
|
|
|
|
bool DoesResponsibleProcessHaveBluetoothMetadata() {
|
|
+#if !IS_MAS_BUILD()
|
|
const pid_t pid = getpid();
|
|
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;
|
|
+#else
|
|
+ return true;
|
|
+#endif
|
|
}
|
|
|
|
} // namespace base
|
|
diff --git a/components/os_crypt/common/keychain_password_mac.mm b/components/os_crypt/common/keychain_password_mac.mm
|
|
index f240dc22ee391c98c8768af7141b7447b6507cc6..69bfbbf0f58ca3b05a601bea87b14dcf0fb2eecb 100644
|
|
--- a/components/os_crypt/common/keychain_password_mac.mm
|
|
+++ b/components/os_crypt/common/keychain_password_mac.mm
|
|
@@ -19,6 +19,7 @@
|
|
#include "base/types/expected.h"
|
|
#include "build/branding_buildflags.h"
|
|
#include "crypto/apple/keychain_v2.h"
|
|
+#include "electron/mas.h"
|
|
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
|
|
|
|
using crypto::apple::KeychainV2;
|
|
diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn
|
|
index f75238dedb47ff7927c715f21befede9cdc97615..e90e275b33bb88c6b1e8a7044ca6eb382460b467 100644
|
|
--- a/components/os_crypt/sync/BUILD.gn
|
|
+++ b/components/os_crypt/sync/BUILD.gn
|
|
@@ -52,6 +52,7 @@ component("sync") {
|
|
deps += [
|
|
"//components/os_crypt/common:keychain_password_mac",
|
|
"//crypto:mock_apple_keychain",
|
|
+ "//electron/build/config:generate_mas_config"
|
|
]
|
|
} else if (is_win) {
|
|
sources += [ "os_crypt_win.cc" ]
|
|
diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn
|
|
index 32001b02032379d6338e59a1cf5ce5619c4e1acb..f3827c60ee95b38acae103b2f3f4a94764610c3d 100644
|
|
--- a/components/remote_cocoa/app_shim/BUILD.gn
|
|
+++ b/components/remote_cocoa/app_shim/BUILD.gn
|
|
@@ -79,6 +79,7 @@ component("app_shim") {
|
|
"//components/crash/core/common",
|
|
"//components/remote_cocoa/common:mojo",
|
|
"//components/system_media_controls",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
"//mojo/public/cpp/bindings",
|
|
"//net",
|
|
"//ui/accelerated_widget_mac",
|
|
diff --git a/components/remote_cocoa/app_shim/NSToolbar+Private.mm b/components/remote_cocoa/app_shim/NSToolbar+Private.mm
|
|
index 5c6f4c37205de6d7cfb91c837ad4586473cf2fdb..551dc7a0e71711eee9d5176a33b345b8b8b276fb 100644
|
|
--- a/components/remote_cocoa/app_shim/NSToolbar+Private.mm
|
|
+++ b/components/remote_cocoa/app_shim/NSToolbar+Private.mm
|
|
@@ -4,6 +4,9 @@
|
|
|
|
#import "components/remote_cocoa/app_shim/NSToolbar+Private.h"
|
|
|
|
+#include "electron/mas.h"
|
|
+
|
|
+#if !IS_MAS_BUILD()
|
|
// Access the private view that backs the toolbar.
|
|
// TODO(http://crbug.com/40261565): Remove when FB12010731 is fixed in AppKit.
|
|
@interface NSToolbar (ToolbarView)
|
|
@@ -18,3 +21,4 @@ - (NSView *)privateToolbarView {
|
|
: nil;
|
|
}
|
|
@end
|
|
+#endif
|
|
diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm
|
|
index d5afd4be1ef4ac3fd1cfa7c09c667bc87b9a6b3a..4f005f2fe24ecfe1962fc64782fb7187161cbd7a 100644
|
|
--- a/components/remote_cocoa/app_shim/application_bridge.mm
|
|
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
|
|
@@ -13,6 +13,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"
|
|
@@ -54,6 +55,7 @@
|
|
|
|
// NativeWidgetNSWindowHostHelper:
|
|
id GetNativeViewAccessible() override {
|
|
+#if !IS_MAS_BUILD()
|
|
if (!remote_accessibility_element_) {
|
|
base::ProcessId browser_pid = base::kNullProcessId;
|
|
std::vector<uint8_t> element_token;
|
|
@@ -64,6 +66,9 @@ id GetNativeViewAccessible() override {
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
}
|
|
return remote_accessibility_element_;
|
|
+#else
|
|
+ return nil;
|
|
+#endif
|
|
}
|
|
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
|
bool event_handled = false;
|
|
@@ -102,7 +107,9 @@ void GetWordAt(const gfx::Point& location_in_content,
|
|
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
|
|
|
|
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
|
|
+#if !IS_MAS_BUILD()
|
|
NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
|
|
+#endif
|
|
};
|
|
|
|
bool g_is_out_of_process_app_shim = false;
|
|
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
|
|
index f7200edbe6059ac6d7ade0672852b52da7642a71..0cc5da96411b46eb39d0c01dfec59cb503df0d9b 100644
|
|
--- a/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
|
|
+++ b/components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
|
|
@@ -9,7 +9,9 @@
|
|
#include "base/mac/mac_util.h"
|
|
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
|
|
#include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
|
|
+#include "electron/mas.h"
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
namespace {
|
|
// Workaround for https://crbug.com/1369643
|
|
const double kThinControllerHeight = 0.5;
|
|
@@ -125,12 +127,15 @@ - (void)maybeShowTrafficLights {
|
|
|
|
@end
|
|
|
|
+#endif // MAS_BUILD
|
|
+
|
|
@implementation BrowserNativeWidgetWindow
|
|
|
|
@synthesize thinTitlebarViewController = _thinTitlebarViewController;
|
|
|
|
// 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])
|
|
@@ -189,6 +194,8 @@ - (BOOL)_usesCustomDrawing {
|
|
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.
|
|
@@ -199,8 +206,8 @@ - (void)_handleFocusToolbarHotKey:(id)unknown {
|
|
}
|
|
|
|
- (void)setAlwaysShowTrafficLights:(BOOL)alwaysShow {
|
|
- [base::apple::ObjCCastStrict<BrowserWindowFrame>(self.contentView.superview)
|
|
- setAlwaysShowTrafficLights:alwaysShow];
|
|
+ // [base::apple::ObjCCastStrict<BrowserWindowFrame>(self.contentView.superview)
|
|
+ // setAlwaysShowTrafficLights:alwaysShow];
|
|
}
|
|
|
|
@end
|
|
diff --git a/components/remote_cocoa/app_shim/menu_controller_cocoa_delegate_impl.mm b/components/remote_cocoa/app_shim/menu_controller_cocoa_delegate_impl.mm
|
|
index 5dd3ae5dff160834524c013594f76f59ad7e2fdd..356d677b9e6addeeb60af6b4e2d63125bc4f51c4 100644
|
|
--- a/components/remote_cocoa/app_shim/menu_controller_cocoa_delegate_impl.mm
|
|
+++ b/components/remote_cocoa/app_shim/menu_controller_cocoa_delegate_impl.mm
|
|
@@ -8,6 +8,7 @@
|
|
#include "base/apple/foundation_util.h"
|
|
#include "base/logging.h"
|
|
#import "base/message_loop/message_pump_apple.h"
|
|
+#import "electron/mas.h"
|
|
#import "skia/ext/skia_utils_mac.h"
|
|
#import "ui/base/cocoa/cocoa_base_utils.h"
|
|
#include "ui/base/interaction/element_tracker_mac.h"
|
|
@@ -111,6 +112,7 @@ - (void)highlightItemAtIndex:(NSInteger)index;
|
|
|
|
@interface NSMenu (Impl)
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// Returns the impl. (If called on macOS 14 this would return a subclass of
|
|
// NSCocoaMenuImpl, but private API use is not needed on macOS 14.)
|
|
- (id<CrNSCarbonMenuImpl>)_menuImpl;
|
|
@@ -119,6 +121,7 @@ @interface NSMenu (Impl)
|
|
// on both Carbon and Cocoa impls, but always (incorrectly) returns a zero
|
|
// origin with the Cocoa impl. Therefore, do not use with macOS 14 or later.
|
|
- (CGRect)_boundsIfOpen;
|
|
+#endif
|
|
|
|
@end
|
|
|
|
@@ -239,6 +242,7 @@ - (void)controllerWillAddMenu:(NSMenu*)menu fromModel:(ui::MenuModel*)model {
|
|
}
|
|
menuShown = true;
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
if (alertedIndex.has_value()) {
|
|
const auto index = base::checked_cast<NSInteger>(alertedIndex.value());
|
|
if (@available(macOS 14.0, *)) {
|
|
@@ -247,6 +251,7 @@ - (void)controllerWillAddMenu:(NSMenu*)menu fromModel:(ui::MenuModel*)model {
|
|
[strongMenu._menuImpl highlightItemAtIndex:index];
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
if (@available(macOS 14.0, *)) {
|
|
for (auto [elementId, index] : elementIds) {
|
|
@@ -267,7 +272,11 @@ - (void)controllerWillAddMenu:(NSMenu*)menu fromModel:(ui::MenuModel*)model {
|
|
dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_MSEC),
|
|
dispatch_get_main_queue(), ^{
|
|
gfx::Rect bounds =
|
|
+#if !IS_MAS_BUILD()
|
|
gfx::ScreenRectFromNSRect(strongMenu._boundsIfOpen);
|
|
+#else
|
|
+ gfx::ScreenRectFromNSRect(NSMakeRect(0, 0, 0, 0));
|
|
+#endif
|
|
for (auto [elementId, index] : elementIds) {
|
|
ui::ElementTrackerMac::GetInstance()->NotifyMenuItemShown(
|
|
strongMenu, elementId, bounds);
|
|
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
|
|
index 3a815ebf505bd95fa7f6b61ba433d98fbfe20225..149de0175c2ec0e41e3ba40caad7019ca87386d6 100644
|
|
--- a/components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
|
|
@@ -4,6 +4,10 @@
|
|
|
|
#import "components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.h"
|
|
|
|
+#include "electron/mas.h"
|
|
+
|
|
+#if !IS_MAS_BUILD()
|
|
+
|
|
@interface NSWindow (PrivateAPI)
|
|
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
|
|
@end
|
|
@@ -18,8 +22,12 @@ - (CGFloat)_titlebarHeight {
|
|
}
|
|
@end
|
|
|
|
+#endif // MAS_BUILD
|
|
+
|
|
@implementation NativeWidgetMacFramelessNSWindow
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
+
|
|
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
|
if ([NativeWidgetMacFramelessNSWindowFrame class]) {
|
|
return [NativeWidgetMacFramelessNSWindowFrame class];
|
|
@@ -27,4 +35,6 @@ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
|
|
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
|
|
index 48f47bf3eeb8464d1c3925f0f73f62c790cac2f0..b7b2b7c1b7e99927012ce1676cc753b2bcdd887b 100644
|
|
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
|
|
@@ -10,6 +10,7 @@
|
|
#include "base/apple/foundation_util.h"
|
|
#import "components/remote_cocoa/app_shim/native_widget_mac_nswindow_headless.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 {
|
|
@@ -18,6 +19,7 @@ class NativeWidgetNSWindowBridge;
|
|
|
|
@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
|
|
@@ -34,6 +36,7 @@ REMOTE_COCOA_APP_SHIM_EXPORT
|
|
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
|
|
index a293573bc4740782fc1bbda8180fa6700016d77e..e7959d485b894e7407187fb660c9186cc0c044a7 100644
|
|
--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
|
|
@@ -23,6 +23,7 @@
|
|
#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"
|
|
#include "ui/accessibility/platform/ax_platform_node.h"
|
|
#import "ui/base/cocoa/user_interface_item_command_handler.h"
|
|
#import "ui/base/cocoa/window_size_constants.h"
|
|
@@ -111,20 +112,24 @@ void OrderChildWindow(NSWindow* child_window,
|
|
|
|
} // namespace
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
@interface NSNextStepFrame (Private)
|
|
- (instancetype)initWithFrame:(NSRect)frame
|
|
styleMask:(NSUInteger)styleMask
|
|
owner:(id)owner;
|
|
@end
|
|
+#endif
|
|
|
|
@interface NSWindow (Private)
|
|
+#if !IS_MAS_BUILD()
|
|
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle;
|
|
-- (BOOL)hasKeyAppearance;
|
|
- (long long)_resizeDirectionForMouseLocation:(CGPoint)location;
|
|
- (BOOL)_isConsideredOpenForPersistentState;
|
|
- (void)_zoomToScreenEdge:(NSUInteger)edge;
|
|
- (void)_removeFromGroups:(NSWindow*)window;
|
|
- (BOOL)_isNonactivatingPanel;
|
|
+#endif
|
|
+- (BOOL)hasKeyAppearance;
|
|
@end
|
|
|
|
struct NSEdgeAndCornerThicknesses {
|
|
@@ -169,13 +174,30 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event;
|
|
@implementation NSView (CRFrameViewAdditions)
|
|
// If a mouseDown: falls through to the frame view, turn it into a window drag.
|
|
- (void)cr_mouseDownOnFrameView:(NSEvent*)event {
|
|
+#if !IS_MAS_BUILD()
|
|
if ([self.window _resizeDirectionForMouseLocation:event.locationInWindow] !=
|
|
-1)
|
|
return;
|
|
+#else
|
|
+ // For MAS builds, approximate the resize direction check.
|
|
+ if (self.window.styleMask & NSWindowStyleMaskResizable) {
|
|
+ constexpr CGFloat kResizeThreshold = 5.0;
|
|
+ NSPoint location = event.locationInWindow;
|
|
+ NSRect frame = self.window.frame;
|
|
+ CGFloat width = NSWidth(frame);
|
|
+ CGFloat height = NSHeight(frame);
|
|
+ if (location.x < kResizeThreshold || location.x > width - kResizeThreshold ||
|
|
+ location.y < kResizeThreshold || location.y > height - kResizeThreshold) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
[self.window performWindowDragWithEvent:event];
|
|
}
|
|
@end
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
+
|
|
@implementation NativeWidgetMacNSWindowTitledFrame
|
|
- (void)mouseDown:(NSEvent*)event {
|
|
if (self.window.isMovable)
|
|
@@ -203,6 +225,8 @@ - (BOOL)usesCustomDrawing {
|
|
}
|
|
@end
|
|
|
|
+#endif // MAS_BUILD
|
|
+
|
|
@implementation NativeWidgetMacNSWindow {
|
|
@private
|
|
CommandDispatcher* __strong _commandDispatcher;
|
|
@@ -278,6 +302,7 @@ - (BOOL)invokeOriginalIsVisibleForTesting {
|
|
// bubbles and the find bar, but these should not be movable.
|
|
// Instead, let's push this up to the parent window which should be
|
|
// the browser.
|
|
+#if !IS_MAS_BUILD()
|
|
- (void)_zoomToScreenEdge:(NSUInteger)edge {
|
|
if (self.parentWindow) {
|
|
[self.parentWindow _zoomToScreenEdge:edge];
|
|
@@ -285,6 +310,7 @@ - (void)_zoomToScreenEdge:(NSUInteger)edge {
|
|
[super _zoomToScreenEdge:edge];
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
// This override helps diagnose lifetime issues in crash stacktraces by
|
|
// inserting a symbol on NativeWidgetMacNSWindow and should be kept even if it
|
|
@@ -417,6 +443,8 @@ - (NSAccessibilityRole)accessibilityRole {
|
|
|
|
// NSWindow overrides.
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
+
|
|
+ (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
|
if (windowStyle & NSWindowStyleMaskTitled) {
|
|
if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
|
|
@@ -428,6 +456,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
|
|
return [super frameViewClassForStyleMask:windowStyle];
|
|
}
|
|
|
|
+#endif
|
|
+
|
|
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen*)screen {
|
|
if (self.isHeadless || self.parentWindow) {
|
|
// AppKit's default implementation moves child windows down to avoid
|
|
@@ -484,12 +514,14 @@ - (BOOL)_usesCustomDrawing {
|
|
// if it were valid to set that style for windows, setting the window style
|
|
// recalculates and re-caches a bunch of stuff, so a surgical override is the
|
|
// cleanest approach.
|
|
+#if !IS_MAS_BUILD()
|
|
- (BOOL)_isNonactivatingPanel {
|
|
if (_activationIndependence) {
|
|
return YES;
|
|
}
|
|
return [super _isNonactivatingPanel];
|
|
}
|
|
+#endif
|
|
|
|
+ (void)_getExteriorResizeEdgeThicknesses:
|
|
(NSEdgeAndCornerThicknesses*)outThicknesses
|
|
@@ -806,9 +838,11 @@ - (id)archiver:(NSKeyedArchiver*)archiver willEncodeObject:(id)object {
|
|
}
|
|
|
|
- (void)saveRestorableState {
|
|
+#if !IS_MAS_BUILD()
|
|
if (!_bridge || ![self _isConsideredOpenForPersistentState]) {
|
|
return;
|
|
}
|
|
+#endif
|
|
|
|
// Certain conditions, such as in the Speedometer 3 benchmark, can trigger a
|
|
// rapid succession of calls to saveRestorableState. If there's no pending
|
|
@@ -875,6 +909,7 @@ - (void)reallySaveRestorableState {
|
|
// affects its restorable state changes.
|
|
- (void)invalidateRestorableState {
|
|
[super invalidateRestorableState];
|
|
+#if !IS_MAS_BUILD()
|
|
if ([self _isConsideredOpenForPersistentState]) {
|
|
if (_willUpdateRestorableState)
|
|
return;
|
|
@@ -887,6 +922,7 @@ - (void)invalidateRestorableState {
|
|
_willUpdateRestorableState = NO;
|
|
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
// On newer SDKs, _canMiniaturize respects NSWindowStyleMaskMiniaturizable in
|
|
@@ -1070,6 +1106,7 @@ - (void)maybeRemoveTreeFromOrderingGroups {
|
|
// Since _removeFromGroups: is not documented it could go away in newer
|
|
// versions of macOS. If the selector does not exist, DumpWithoutCrashing() so
|
|
// we hear about the change.
|
|
+#if !IS_MAS_BUILD()
|
|
if (![NSWindow instancesRespondToSelector:@selector(_removeFromGroups:)]) {
|
|
base::debug::DumpWithoutCrashing();
|
|
return;
|
|
@@ -1087,6 +1124,7 @@ - (void)maybeRemoveTreeFromOrderingGroups {
|
|
[currentWindow _removeFromGroups:child];
|
|
}
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
- (NSWindow*)rootWindow {
|
|
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
|
|
index 07e0b72bb9807d21f6ef8597b0b6422d30f01003..2fd9022f3924d5d47920efaea455b770affd79d2 100644
|
|
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
@@ -42,6 +42,7 @@
|
|
#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"
|
|
@@ -75,10 +76,13 @@
|
|
using CGRegionRef = CFTypeRef;
|
|
|
|
CG_EXTERN CGSConnectionID CGSMainConnectionID(void);
|
|
+
|
|
+#if !IS_MAS_BUILD()
|
|
CG_EXTERN CGError CGSSetWindowCaptureExcludeShape(CGSConnectionID cid,
|
|
CGSWindowID wid,
|
|
CGRegionRef region);
|
|
CG_EXTERN CGRegionRef CGRegionCreateWithRect(CGRect rect);
|
|
+#endif
|
|
|
|
namespace {
|
|
constexpr auto kUIPaintTimeout = base::Milliseconds(500);
|
|
@@ -756,10 +760,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
|
// 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
|
|
@@ -1256,6 +1262,7 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
|
}
|
|
|
|
void NativeWidgetNSWindowBridge::SetAllowScreenshots(bool allow) {
|
|
+#if !IS_MAS_BUILD()
|
|
CGSConnectionID connection_id = CGSMainConnectionID();
|
|
CGSWindowID window_id = ns_window().windowNumber;
|
|
CGRect frame = ns_window().frame;
|
|
@@ -1265,6 +1272,10 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
|
region.reset(CGRegionCreateWithRect(frame));
|
|
}
|
|
CGSSetWindowCaptureExcludeShape(connection_id, window_id, region.get());
|
|
+#else
|
|
+ [ns_window()
|
|
+ setSharingType:allow ? NSWindowSharingReadOnly : NSWindowSharingNone];
|
|
+#endif
|
|
}
|
|
|
|
void NativeWidgetNSWindowBridge::SetColorMode(
|
|
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
|
|
index 1001fc872ae76c80c285a00f96a43c12910937cc..44072bd19a908aa0604e440e89c303cd8044f342 100644
|
|
--- a/components/viz/service/BUILD.gn
|
|
+++ b/components/viz/service/BUILD.gn
|
|
@@ -395,6 +395,7 @@ viz_component("service") {
|
|
"frame_sinks/external_begin_frame_source_mojo_mac.h",
|
|
]
|
|
}
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
if (is_ios) {
|
|
@@ -740,6 +741,7 @@ viz_source_set("unit_tests") {
|
|
"display_embedder/software_output_device_mac_unittest.mm",
|
|
]
|
|
frameworks = [ "IOSurface.framework" ]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
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
|
|
index 010c713090e5038dc90db131c8f621422d30c03b..20c35e887a0496ee609c077e3b0494bdded41dba 100644
|
|
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
@@ -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(
|
|
const RenderWidgetHostNSViewBridgeOwner&) = delete;
|
|
|
|
private:
|
|
+#if !IS_MAS_BUILD()
|
|
NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
|
|
+#endif
|
|
void OnMojoDisconnect() { delete this; }
|
|
|
|
std::unique_ptr<blink::WebCoalescedInputEvent> TranslateEvent(
|
|
@@ -75,6 +78,7 @@ explicit RenderWidgetHostNSViewBridgeOwner(
|
|
}
|
|
|
|
id GetAccessibilityElement() override {
|
|
+#if !IS_MAS_BUILD()
|
|
if (!remote_accessibility_element_) {
|
|
base::ProcessId browser_pid = base::kNullProcessId;
|
|
std::vector<uint8_t> element_token;
|
|
@@ -85,6 +89,9 @@ id GetAccessibilityElement() override {
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
}
|
|
return remote_accessibility_element_;
|
|
+#else
|
|
+ return nil;
|
|
+#endif
|
|
}
|
|
|
|
// RenderWidgetHostNSViewHostHelper implementation.
|
|
@@ -103,8 +110,10 @@ id GetFocusedBrowserAccessibilityElement() override {
|
|
return [bridgedContentView accessibilityFocusedUIElement];
|
|
}
|
|
void SetAccessibilityWindow(NSWindow* window) override {
|
|
+#if !IS_MAS_BUILD()
|
|
host_->SetRemoteAccessibilityWindowToken(
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window));
|
|
+#endif
|
|
}
|
|
|
|
void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event,
|
|
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
|
|
index 989b11c5b67343fbb03bb849e1b3febd6167a00e..5310b9905ad76154ff7c5f5fca48d63fe0d1136c 100644
|
|
--- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
|
+++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
|
|
@@ -33,6 +33,7 @@
|
|
#import "content/public/browser/render_widget_host_view_mac_delegate.h"
|
|
#include "content/public/browser/scoped_accessibility_mode.h"
|
|
#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"
|
|
@@ -2258,15 +2259,21 @@ - (NSAccessibilityRole)accessibilityRole {
|
|
// 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
|
|
index 65f4f7cb0162257b5223f324acdf6fcb0c295c27..908fff2acf576f925b9309e3b024c150e5b15632 100644
|
|
--- a/content/browser/BUILD.gn
|
|
+++ b/content/browser/BUILD.gn
|
|
@@ -364,6 +364,7 @@ source_set("browser") {
|
|
"//ui/webui/resources",
|
|
"//v8",
|
|
"//v8:v8_version",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
|
|
public_deps = [
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
index 2575ac6b4211b43447a39f9ce89077182ef0cf54..1bce550e07780196b7606545cac1e9ae7cf0f563 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
@@ -25,6 +25,7 @@
|
|
#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/common/page/content_to_visible_time_request.h"
|
|
@@ -55,7 +56,9 @@ class CursorManager;
|
|
|
|
@protocol RenderWidgetHostViewMacDelegate;
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
@class NSAccessibilityRemoteUIElement;
|
|
+#endif
|
|
@class RenderWidgetHostViewCocoa;
|
|
|
|
namespace content {
|
|
@@ -682,9 +685,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
|
|
// 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
|
|
index 4ef475fb46fb12bc9f4dd8b17ab44568084932e4..a8c01d4ac0e60fc7427191d51ab51c42d9e5f1c2 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
@@ -54,6 +54,7 @@
|
|
#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"
|
|
@@ -291,8 +292,10 @@
|
|
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.
|
|
@@ -1720,10 +1723,12 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
|
|
gfx::NativeViewAccessible
|
|
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
|
|
+#if !IS_MAS_BUILD()
|
|
if (remote_window_accessible_) {
|
|
return gfx::NativeViewAccessible(
|
|
(id<NSAccessibility>)remote_window_accessible_);
|
|
}
|
|
+#endif
|
|
return gfx::NativeViewAccessible([GetInProcessNSView() window]);
|
|
}
|
|
|
|
@@ -1775,9 +1780,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
}
|
|
|
|
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(
|
|
@@ -2312,20 +2319,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken(
|
|
GetRenderWidgetAccessibilityTokenCallback callback) {
|
|
base::ProcessId pid = getpid();
|
|
+#if !IS_MAS_BUILD()
|
|
id element_id = GetNativeViewAccessible().Get();
|
|
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
|
|
}
|
|
|
|
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
|
|
index 6294792999d1653b73c695ebfddda0f8a45d82c9..da6be02dcff5d956e69fa356ec6dea65aa9780af 100644
|
|
--- a/content/common/BUILD.gn
|
|
+++ b/content/common/BUILD.gn
|
|
@@ -282,6 +282,7 @@ source_set("common") {
|
|
"//ui/shell_dialogs",
|
|
"//url",
|
|
"//url/ipc:url_ipc",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
|
|
defines = []
|
|
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
|
|
index a99405158fbecc5e08b334c4e40f40f51e92b2d9..f35b1a1a6c9c3a28573fee901652a55b82756cfd 100644
|
|
--- a/content/renderer/BUILD.gn
|
|
+++ b/content/renderer/BUILD.gn
|
|
@@ -322,6 +322,7 @@ target(link_target_type, "renderer") {
|
|
"//ui/strings:auto_image_annotation_strings_grit",
|
|
"//url",
|
|
"//v8",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
allow_circular_includes_from = []
|
|
|
|
diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm
|
|
index d4db3b179725cb96bcbd0f73db7d52ef8b7522db..703b0f56a61abac51961bfd918b7349b943900de 100644
|
|
--- a/content/renderer/renderer_main_platform_delegate_mac.mm
|
|
+++ b/content/renderer/renderer_main_platform_delegate_mac.mm
|
|
@@ -7,12 +7,15 @@
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#include "base/check_op.h"
|
|
+#include "electron/mas.h"
|
|
#include "sandbox/mac/seatbelt.h"
|
|
#include "sandbox/mac/system_services.h"
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
CGError CGSSetDenyWindowServerConnections(bool);
|
|
}
|
|
+#endif
|
|
|
|
namespace content {
|
|
|
|
@@ -22,6 +25,7 @@
|
|
// 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.
|
|
@@ -30,6 +34,7 @@ void DisableSystemServices() {
|
|
|
|
sandbox::DisableLaunchServices();
|
|
sandbox::DisableCoreServicesCheckFix();
|
|
+#endif
|
|
}
|
|
|
|
} // namespace
|
|
diff --git a/content/renderer/theme_helper_mac.mm b/content/renderer/theme_helper_mac.mm
|
|
index a1068589ad844518038ee7bc15a3de9bc5cba525..1ff781c49f086ec8015c7d3c44567dbec3d00ff8 100644
|
|
--- a/content/renderer/theme_helper_mac.mm
|
|
+++ b/content/renderer/theme_helper_mac.mm
|
|
@@ -7,16 +7,28 @@
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
+#include "electron/mas.h"
|
|
|
|
+#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
|
|
index e2bec3d7c7667279e8fd7411a76fe72c539cce0a..1b9d1b8c54ecf3b5572dd0dbb510b31af04f3a70 100644
|
|
--- a/content/test/BUILD.gn
|
|
+++ b/content/test/BUILD.gn
|
|
@@ -702,6 +702,7 @@ static_library("test_support") {
|
|
"//url",
|
|
"//url/mojom:url_mojom_gurl",
|
|
"//v8",
|
|
+ "//electron/build/config:generate_mas_config"
|
|
]
|
|
|
|
data_deps = [
|
|
@@ -1177,6 +1178,8 @@ static_library("browsertest_support") {
|
|
# 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" ]
|
|
+
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
mojom("content_test_mojo_bindings") {
|
|
@@ -2074,6 +2077,7 @@ test("content_browsertests") {
|
|
"//ui/shell_dialogs",
|
|
"//ui/snapshot",
|
|
"//ui/webui:test_support",
|
|
+ "//electron/build/config:generate_mas_config"
|
|
]
|
|
|
|
if (!(is_chromeos && target_cpu == "arm64" && current_cpu == "arm")) {
|
|
@@ -3457,6 +3461,7 @@ test("content_unittests") {
|
|
"//ui/shell_dialogs",
|
|
"//ui/webui:test_support",
|
|
"//url",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
|
|
if (is_chromeos) {
|
|
diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn
|
|
index 7a9360beb22370b61d80f8a84f6b1f96d2d77c3b..708c61c16e7baa9fcc2124722714d7d908bd5345 100644
|
|
--- a/content/web_test/BUILD.gn
|
|
+++ b/content/web_test/BUILD.gn
|
|
@@ -221,6 +221,7 @@ static_library("web_test_browser") {
|
|
"//ui/gl",
|
|
"//ui/shell_dialogs",
|
|
"//url",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
|
|
if (is_mac) {
|
|
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn
|
|
index 3504d7197bd3225b6b83d7e057f389d8327b9ff7..92547d8bc700f3139f4bbc77d621152e0bc2a81c 100644
|
|
--- a/device/bluetooth/BUILD.gn
|
|
+++ b/device/bluetooth/BUILD.gn
|
|
@@ -257,6 +257,7 @@ component("bluetooth") {
|
|
"CoreBluetooth.framework",
|
|
"Foundation.framework",
|
|
]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
if (is_mac) {
|
|
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
|
index f300e8d331057e894b43b74944e5052c39206844..4ff5277d550485cd79c5b5316d89c730ba709254 100644
|
|
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
|
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
|
@@ -39,7 +39,9 @@
|
|
#include "device/bluetooth/bluetooth_discovery_session_outcome.h"
|
|
#include "device/bluetooth/bluetooth_socket_mac.h"
|
|
#include "device/bluetooth/public/cpp/bluetooth_address.h"
|
|
+#include "electron/mas.h"
|
|
|
|
+#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
|
|
@@ -53,6 +55,7 @@
|
|
// [4] https://support.apple.com/kb/PH25091
|
|
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
|
}
|
|
+#endif
|
|
|
|
// A simple helper class that forwards any Bluetooth device connect notification
|
|
// to its wrapped |_adapter|.
|
|
@@ -162,8 +165,10 @@ bool IsDeviceSystemPaired(const std::string& device_address) {
|
|
: 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_(
|
|
base::BindRepeating(&IsDeviceSystemPaired)) {
|
|
}
|
|
@@ -314,8 +319,12 @@ bool IsDeviceSystemPaired(const std::string& device_address) {
|
|
}
|
|
|
|
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
|
|
index 03a74b7d29f12be3a5d208b43beaa13f47a8e4a6..d36254ca28c1a3a4ef2b15cfbb3272129588cc20 100644
|
|
--- a/gpu/ipc/service/BUILD.gn
|
|
+++ b/gpu/ipc/service/BUILD.gn
|
|
@@ -125,6 +125,7 @@ component("service") {
|
|
"QuartzCore.framework",
|
|
]
|
|
defines += [ "GL_SILENCE_DEPRECATION" ]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
if (is_ios) {
|
|
sources += [ "image_transport_surface_ios.mm" ]
|
|
diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h
|
|
index 8b680a115718c94c9b8d7027594ac953daf201d7..20a973c240973f2fb2e782209e75da8799d90851 100644
|
|
--- a/gpu/ipc/service/image_transport_surface_overlay_mac.h
|
|
+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h
|
|
@@ -9,6 +9,7 @@
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "base/power_monitor/power_observer.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"
|
|
@@ -28,7 +29,9 @@
|
|
#include <BrowserEngineKit/BrowserEngineKit.h>
|
|
#endif
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
@class CAContext;
|
|
+#endif
|
|
@class CALayer;
|
|
|
|
namespace ui {
|
|
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn
|
|
index 2939a4183785608041041642ee81287d0fbd605d..89081a4d8e1dedbe8d45a824c5823601dea53029 100644
|
|
--- a/media/audio/BUILD.gn
|
|
+++ b/media/audio/BUILD.gn
|
|
@@ -197,6 +197,7 @@ source_set("audio") {
|
|
"CoreMedia.framework",
|
|
]
|
|
weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
if (is_ios) {
|
|
diff --git a/media/audio/apple/audio_low_latency_input.cc b/media/audio/apple/audio_low_latency_input.cc
|
|
index 02ddb6aedb21d85dfb7de91944198c291399063e..adb9c6165f52162b8fd84792c6b710034e263c4a 100644
|
|
--- a/media/audio/apple/audio_low_latency_input.cc
|
|
+++ b/media/audio/apple/audio_low_latency_input.cc
|
|
@@ -26,6 +26,7 @@
|
|
#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"
|
|
@@ -39,19 +40,23 @@
|
|
|
|
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
|
|
#endif
|
|
diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn
|
|
index 9fc0b476389adfedac91066935ed8a33e80b9e7e..bde6df33160fc8a895722d65bbddb4577c515d89 100644
|
|
--- a/net/dns/BUILD.gn
|
|
+++ b/net/dns/BUILD.gn
|
|
@@ -222,6 +222,8 @@ source_set("dns") {
|
|
":host_resolver_manager",
|
|
":mdns_client",
|
|
]
|
|
+
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
# The standard API of net/dns.
|
|
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
|
|
index f863fceb0b35555e4c3bc334c0c082bb2bed2a97..1120297f383826523d9131a73eea7b956375d76c 100644
|
|
--- a/net/dns/dns_config_service_posix.cc
|
|
+++ b/net/dns/dns_config_service_posix.cc
|
|
@@ -24,6 +24,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"
|
|
@@ -131,8 +132,8 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher {
|
|
|
|
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.";
|
|
@@ -149,6 +150,7 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher {
|
|
success = false;
|
|
}
|
|
#endif // !BUILDFLAG(IS_IOS)
|
|
+#endif
|
|
return success;
|
|
}
|
|
|
|
diff --git a/sandbox/mac/BUILD.gn b/sandbox/mac/BUILD.gn
|
|
index d145bdb3f879ae7e2d77f3b58fe7abd09d6f7255..8973f310aa62b59bc829e8e0f8ed068bfffa3f2b 100644
|
|
--- a/sandbox/mac/BUILD.gn
|
|
+++ b/sandbox/mac/BUILD.gn
|
|
@@ -25,6 +25,7 @@ component("seatbelt") {
|
|
libs = [ "sandbox" ]
|
|
deps = [ ":seatbelt_export" ]
|
|
defines = [ "SEATBELT_IMPLEMENTATION" ]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
component("seatbelt_extension") {
|
|
@@ -38,6 +39,7 @@ component("seatbelt_extension") {
|
|
libs = [ "sandbox" ]
|
|
public_deps = [ "//base" ]
|
|
defines = [ "SEATBELT_IMPLEMENTATION" ]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
component("system_services") {
|
|
@@ -52,6 +54,7 @@ component("system_services") {
|
|
deps = [ ":seatbelt_export" ]
|
|
public_deps = [ "//base" ]
|
|
defines = [ "SEATBELT_IMPLEMENTATION" ]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
source_set("sandbox_unittests") {
|
|
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
|
|
index 950cf7cfee4e11766dccf5c0bf3f15a8562f0f1e..2d99498b83180f1aa4b79cfab0ea2b1f27080106 100644
|
|
--- a/sandbox/mac/sandbox_logging.cc
|
|
+++ b/sandbox/mac/sandbox_logging.cc
|
|
@@ -21,6 +21,7 @@
|
|
#include <string>
|
|
|
|
#include "build/build_config.h"
|
|
+#include "electron/mas.h"
|
|
#include "sandbox/mac/sandbox_crash_message.h"
|
|
|
|
#if defined(ARCH_CPU_X86_64)
|
|
@@ -38,9 +39,11 @@
|
|
}
|
|
#endif
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
void abort_report_np(const char*, ...);
|
|
}
|
|
+#endif
|
|
|
|
namespace sandbox::logging {
|
|
|
|
@@ -82,7 +85,12 @@ void SendOsLog(Level level, const char* message) {
|
|
}
|
|
|
|
if (level == Level::FATAL) {
|
|
+#if !IS_MAS_BUILD()
|
|
abort_report_np(message);
|
|
+#else
|
|
+ os_log_fault(OS_LOG_DEFAULT, "%s", message);
|
|
+ abort();
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
diff --git a/sandbox/mac/sandbox_serializer.cc b/sandbox/mac/sandbox_serializer.cc
|
|
index 0e6e650f88e6aadd46bec96a8b41768c37d7cc6a..a6830e3f886e408c254ccd1c2b1d5c15cd3bcb92 100644
|
|
--- a/sandbox/mac/sandbox_serializer.cc
|
|
+++ b/sandbox/mac/sandbox_serializer.cc
|
|
@@ -8,6 +8,7 @@
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
+#include "electron/mas.h"
|
|
#include "sandbox/mac/sandbox_logging.h"
|
|
#include "sandbox/mac/seatbelt.h"
|
|
|
|
@@ -193,6 +194,7 @@ SandboxSerializer::DeserializePolicy(const std::string& serialized_policy,
|
|
// static
|
|
bool SandboxSerializer::ApplySerializedPolicy(
|
|
const std::string& serialized_policy) {
|
|
+#if !IS_MAS_BUILD()
|
|
std::string error;
|
|
std::optional<DeserializedPolicy> deserialized_policy =
|
|
DeserializePolicy(serialized_policy, error);
|
|
@@ -223,6 +225,9 @@ bool SandboxSerializer::ApplySerializedPolicy(
|
|
break;
|
|
}
|
|
return true;
|
|
+#else
|
|
+ return true;
|
|
+#endif
|
|
}
|
|
|
|
} // namespace sandbox
|
|
diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc
|
|
index e9321ba5fc0f1b24b2d990ecb27c8aaa1c8b970b..51df9671a507acd115f09a50c2d6e987fb4183c2 100644
|
|
--- a/sandbox/mac/seatbelt.cc
|
|
+++ b/sandbox/mac/seatbelt.cc
|
|
@@ -4,6 +4,8 @@
|
|
|
|
#include "sandbox/mac/seatbelt.h"
|
|
|
|
+#include "electron/mas.h"
|
|
+
|
|
#include <errno.h>
|
|
#include <unistd.h>
|
|
|
|
@@ -12,7 +14,7 @@
|
|
|
|
extern "C" {
|
|
#include <sandbox.h>
|
|
-
|
|
+#if !IS_MAS_BUILD()
|
|
int sandbox_init_with_parameters(const char* profile,
|
|
uint64_t flags,
|
|
const char* const parameters[],
|
|
@@ -58,13 +60,14 @@ sandbox_profile_t* sandbox_compile_string(const char* data,
|
|
char** error);
|
|
int sandbox_apply(sandbox_profile_t*);
|
|
void sandbox_free_profile(sandbox_profile_t*);
|
|
-
|
|
+#endif
|
|
} // extern "C"
|
|
|
|
namespace sandbox {
|
|
|
|
namespace {
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// `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) {
|
|
}
|
|
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.
|
|
@@ -147,6 +162,7 @@ const char* Seatbelt::kProfilePureComputation = kSBXProfilePureComputation;
|
|
|
|
// 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
|
|
@@ -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);
|
|
#pragma clang diagnostic pop
|
|
+#else
|
|
+ return true;
|
|
+#endif
|
|
}
|
|
|
|
// static
|
|
@@ -163,17 +182,22 @@ bool Seatbelt::InitWithParams(const std::string& profile,
|
|
uint64_t flags,
|
|
const std::vector<std::string>& parameters,
|
|
std::string* error) {
|
|
+#if !IS_MAS_BUILD()
|
|
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);
|
|
+
|
|
char* errorbuf = nullptr;
|
|
int rv = ::sandbox_init_with_parameters(profile.c_str(), flags,
|
|
weak_params.data(), &errorbuf);
|
|
return HandleSandboxResult(
|
|
rv, std::unique_ptr<char, sandbox_error_deleter>(errorbuf), error);
|
|
+#else
|
|
+ return true;
|
|
+#endif
|
|
}
|
|
|
|
// static
|
|
@@ -181,6 +205,7 @@ bool Seatbelt::Compile(const char* profile,
|
|
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);
|
|
@@ -192,23 +217,32 @@ bool Seatbelt::Compile(const char* profile,
|
|
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
|
|
index 79edca9ca521d1bc2ff343967348eb98039b292a..23f9410ee66024e2c6b0b6b2b356a67b0ae2eba7 100644
|
|
--- a/sandbox/mac/seatbelt_extension.cc
|
|
+++ b/sandbox/mac/seatbelt_extension.cc
|
|
@@ -9,8 +9,10 @@
|
|
#include "base/check.h"
|
|
#include "base/memory/ptr_util.h"
|
|
#include "base/notreached.h"
|
|
+#include "electron/mas.h"
|
|
#include "sandbox/mac/seatbelt_extension_token.h"
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// libsandbox private API.
|
|
extern "C" {
|
|
extern const char* APP_SANDBOX_READ;
|
|
@@ -22,6 +24,7 @@ char* sandbox_extension_issue_file(const char* type,
|
|
const char* path,
|
|
uint32_t flags);
|
|
}
|
|
+#endif
|
|
|
|
namespace sandbox {
|
|
|
|
@@ -50,7 +53,11 @@ std::unique_ptr<SeatbeltExtension> SeatbeltExtension::FromToken(
|
|
|
|
bool SeatbeltExtension::Consume() {
|
|
DCHECK(!token_.empty());
|
|
+#if !IS_MAS_BUILD()
|
|
handle_ = sandbox_extension_consume(token_.c_str());
|
|
+#else
|
|
+ handle_ = -1;
|
|
+#endif
|
|
return handle_ > 0;
|
|
}
|
|
|
|
@@ -62,7 +69,11 @@ bool SeatbeltExtension::ConsumePermanently() {
|
|
}
|
|
|
|
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;
|
|
@@ -80,12 +91,14 @@ SeatbeltExtension::SeatbeltExtension(const std::string& token)
|
|
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:
|
|
NOTREACHED();
|
|
}
|
|
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
|
|
index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..9921ccb10d3455600eddd85f77f10228016389af 100644
|
|
--- a/sandbox/mac/system_services.cc
|
|
+++ b/sandbox/mac/system_services.cc
|
|
@@ -8,7 +8,9 @@
|
|
#include <CoreFoundation/CoreFoundation.h>
|
|
|
|
#include "base/apple/osstatus_logging.h"
|
|
+#include "electron/mas.h"
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
|
|
void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
|
@@ -19,10 +21,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
|
// 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
|
|
@@ -36,10 +40,13 @@ void DisableLaunchServices() {
|
|
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
|
|
index e11fff5457e83d93fb3c56513cdb68441b7be8ee..7cf5c8fca1cba1ac9bae1c81554fe4a3877709a6 100644
|
|
--- a/third_party/blink/renderer/core/BUILD.gn
|
|
+++ b/third_party/blink/renderer/core/BUILD.gn
|
|
@@ -442,6 +442,7 @@ component("core") {
|
|
"//ui/gfx/geometry",
|
|
"//ui/gfx/geometry:geometry_skia",
|
|
"//ui/strings",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
|
|
if (is_mac) {
|
|
diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni
|
|
index 63cf79f0d81aa3d6027995e53507c7ba91f8c8f8..aea2f6501bf786ad6a3d7e1654714aa4ff0b21f2 100644
|
|
--- a/third_party/blink/renderer/core/editing/build.gni
|
|
+++ b/third_party/blink/renderer/core/editing/build.gni
|
|
@@ -373,10 +373,14 @@ blink_core_sources_editing = [
|
|
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/third_party/blink/renderer/core/editing/kill_ring_mac.mm b/third_party/blink/renderer/core/editing/kill_ring_mac.mm
|
|
index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..3e3aaea0ec6c8fad0d90a931d269af3af01ab73a 100644
|
|
--- a/third_party/blink/renderer/core/editing/kill_ring_mac.mm
|
|
+++ b/third_party/blink/renderer/core/editing/kill_ring_mac.mm
|
|
@@ -25,8 +25,11 @@
|
|
|
|
#import "third_party/blink/renderer/core/editing/kill_ring.h"
|
|
|
|
+#include "electron/mas.h"
|
|
+
|
|
namespace blink {
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
|
|
// Kill ring calls. Would be better to use NSKillRing.h, but that's not
|
|
@@ -39,7 +42,9 @@
|
|
void _NSNewKillRingSequence();
|
|
void _NSSetKillRingToYankedState();
|
|
}
|
|
+#endif // !IS_MAS_BUILD()
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
static void InitializeKillRingIfNeeded() {
|
|
static bool initialized_kill_ring = false;
|
|
if (!initialized_kill_ring) {
|
|
@@ -47,30 +52,43 @@ static void InitializeKillRingIfNeeded() {
|
|
_NSInitializeKillRing();
|
|
}
|
|
}
|
|
+#endif // !IS_MAS_BUILD()
|
|
|
|
void KillRing::Append(const String& string) {
|
|
+#if !IS_MAS_BUILD()
|
|
InitializeKillRingIfNeeded();
|
|
_NSAppendToKillRing(string);
|
|
+#endif // !IS_MAS_BUILD()
|
|
}
|
|
|
|
void KillRing::Prepend(const String& string) {
|
|
+#if !IS_MAS_BUILD()
|
|
InitializeKillRingIfNeeded();
|
|
_NSPrependToKillRing(string);
|
|
+#endif // !IS_MAS_BUILD()
|
|
}
|
|
|
|
String KillRing::Yank() {
|
|
+#if !IS_MAS_BUILD()
|
|
InitializeKillRingIfNeeded();
|
|
return _NSYankFromKillRing();
|
|
+#else
|
|
+ return String();
|
|
+#endif // !IS_MAS_BUILD()
|
|
}
|
|
|
|
void KillRing::StartNewSequence() {
|
|
+#if !IS_MAS_BUILD()
|
|
InitializeKillRingIfNeeded();
|
|
_NSNewKillRingSequence();
|
|
+#endif // !IS_MAS_BUILD()
|
|
}
|
|
|
|
void KillRing::SetToYankedState() {
|
|
+#if !IS_MAS_BUILD()
|
|
InitializeKillRingIfNeeded();
|
|
_NSSetKillRingToYankedState();
|
|
+#endif // !IS_MAS_BUILD()
|
|
}
|
|
|
|
} // namespace blink
|
|
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm
|
|
index 5bcd0768406a83da96a3167120f1c6b2fa614ee5..0c3bbf77a56b4ad7d0d95816a9127d03ce5dc3f8 100644
|
|
--- a/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm
|
|
+++ b/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm
|
|
@@ -37,6 +37,7 @@
|
|
#include "base/apple/bridging.h"
|
|
#include "base/apple/foundation_util.h"
|
|
#include "base/apple/scoped_cftyperef.h"
|
|
+#include "electron/mas.h"
|
|
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
|
|
#include "third_party/blink/renderer/platform/fonts/font_selection_types.h"
|
|
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
|
|
@@ -60,8 +61,10 @@
|
|
// We don't need localized variation axis name, so we can use
|
|
// `CTFontCopyVariationAxesInternal()` instead.
|
|
// Request for public API: FB13788219.
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" CFArrayRef CTFontCopyVariationAxesInternal(CTFontRef)
|
|
CT_AVAILABLE(macos(12.1));
|
|
+#endif
|
|
|
|
namespace blink {
|
|
|
|
@@ -453,12 +456,16 @@ void ClampVariationValuesToFontAcceptableRange(
|
|
// we are enabling it only on MacOS 13+ because these are our benchmarking
|
|
// platforms.
|
|
NSArray* all_axes;
|
|
+#if !IS_MAS_BUILD()
|
|
if (@available(macOS 13.0, *)) {
|
|
all_axes =
|
|
CFToNSOwnershipCast(CTFontCopyVariationAxesInternal(ct_font.get()));
|
|
} else {
|
|
all_axes = CFToNSOwnershipCast(CTFontCopyVariationAxes(ct_font.get()));
|
|
}
|
|
+#else
|
|
+ all_axes = CFToNSOwnershipCast(CTFontCopyVariationAxes(ct_font.get()));
|
|
+#endif
|
|
if (!all_axes) {
|
|
return;
|
|
}
|
|
diff --git a/ui/accelerated_widget_mac/BUILD.gn b/ui/accelerated_widget_mac/BUILD.gn
|
|
index 0f8a6f75b7f01029adc2f5fd23559bacce19cf72..cf66c2f4f02a8e21cc83c3b7389fc5156bcd93ba 100644
|
|
--- a/ui/accelerated_widget_mac/BUILD.gn
|
|
+++ b/ui/accelerated_widget_mac/BUILD.gn
|
|
@@ -83,6 +83,7 @@ component("accelerated_widget_mac") {
|
|
"//ui/gfx",
|
|
"//ui/gfx/geometry",
|
|
"//ui/gl",
|
|
+ "//electron/build/config:generate_mas_config",
|
|
]
|
|
}
|
|
|
|
diff --git a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
|
|
index 8542a74f1b0e90cd32c0220ef2e82c7763b1ee97..52c989796a2251b52615a04028fece3903e75151 100644
|
|
--- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
|
|
+++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
|
|
@@ -8,13 +8,16 @@
|
|
#include <queue>
|
|
|
|
#include "base/containers/queue.h"
|
|
+#include "electron/mas.h"
|
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h"
|
|
#include "ui/gfx/ca_layer_result.h"
|
|
#include "ui/gfx/presentation_feedback.h"
|
|
#include "ui/gl/gl_context.h"
|
|
#include "ui/gl/presenter.h"
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
@class CAContext;
|
|
+#endif
|
|
@class CALayer;
|
|
@protocol MTLDevice;
|
|
|
|
@@ -120,7 +123,9 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALayerTreeCoordinator {
|
|
// 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
|
|
index 00de2fe5bcc1bf45296f186d16b69ecf4215226c..9866fc255ebbe770928fcf9c3e694642b6629925 100644
|
|
--- a/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
|
|
+++ b/ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
|
|
@@ -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/accelerated_widget_mac/ca_renderer_layer_tree.h"
|
|
#include "ui/base/cocoa/animation_utils.h"
|
|
#include "ui/base/cocoa/remote_layer_api.h"
|
|
@@ -39,6 +40,7 @@
|
|
gl_make_current_callback_(gl_make_current_callback),
|
|
metal_device_(metal_device),
|
|
no_post_task_for_callback_(no_post_task_for_callback) {
|
|
+#if !IS_MAS_BUILD()
|
|
if (allow_remote_layers_) {
|
|
root_ca_layer_ = [[CALayer alloc] init];
|
|
#if BUILDFLAG(IS_MAC)
|
|
@@ -67,6 +69,7 @@
|
|
#endif
|
|
ca_context_.layer = root_ca_layer_;
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
CALayerTreeCoordinator::~CALayerTreeCoordinator() = default;
|
|
@@ -209,9 +212,13 @@
|
|
TRACE_EVENT_INSTANT("test_gpu", "SwapBuffers", "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_);
|
|
diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
|
index 862094f2f03a18b22bdfd5095731614fec6da795..8bb9f07b885919caceaf3bec2494375bb41d4d41 100644
|
|
--- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
|
+++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm
|
|
@@ -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"
|
|
@@ -120,6 +121,7 @@ - (void)setContentsChanged;
|
|
}
|
|
|
|
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;
|
|
@@ -149,6 +151,9 @@ - (void)setContentsChanged;
|
|
[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
|
|
index 2482c9e1903dd7054783248879c182b018dae574..919720086b8c4f839ce0e4e6546f9c2299a79031 100644
|
|
--- a/ui/accessibility/platform/BUILD.gn
|
|
+++ b/ui/accessibility/platform/BUILD.gn
|
|
@@ -301,6 +301,7 @@ component("platform") {
|
|
"AppKit.framework",
|
|
"Foundation.framework",
|
|
]
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
if (is_ios) {
|
|
diff --git a/ui/accessibility/platform/browser_accessibility_manager_mac.mm b/ui/accessibility/platform/browser_accessibility_manager_mac.mm
|
|
index 7d9c479a3035abbb3e4c5accde9e0d0b6b500457..0244e283b806dd385f940e1f7caeaa625227210b 100644
|
|
--- a/ui/accessibility/platform/browser_accessibility_manager_mac.mm
|
|
+++ b/ui/accessibility/platform/browser_accessibility_manager_mac.mm
|
|
@@ -14,6 +14,7 @@
|
|
#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"
|
|
#include "ui/accessibility/accessibility_features.h"
|
|
#include "ui/accessibility/ax_role_properties.h"
|
|
@@ -22,7 +23,9 @@
|
|
#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 {
|
|
|
|
@@ -235,6 +238,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
return;
|
|
}
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
BrowserAccessibilityManager* root_manager = GetManagerForRootFrame();
|
|
if (root_manager) {
|
|
BrowserAccessibilityManagerMac* root_manager_mac =
|
|
@@ -257,6 +261,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
return;
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
// Use native VoiceOver support for live regions.
|
|
BrowserAccessibilityCocoa* retained_node = native_node;
|
|
@@ -722,6 +727,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
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
|
|
@@ -750,6 +756,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
|
if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) {
|
|
return true;
|
|
}
|
|
+#endif
|
|
|
|
return false;
|
|
}
|
|
diff --git a/ui/accessibility/platform/inspect/ax_transform_mac.mm b/ui/accessibility/platform/inspect/ax_transform_mac.mm
|
|
index ef031ba14e4c649f6f3a5718ac521e6b424d64cb..38e528450196b4dbd5fa6a25b96baa10980fe73c 100644
|
|
--- a/ui/accessibility/platform/inspect/ax_transform_mac.mm
|
|
+++ b/ui/accessibility/platform/inspect/ax_transform_mac.mm
|
|
@@ -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 @@
|
|
}
|
|
}
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
// AXTextMarker
|
|
if (IsAXTextMarker(value)) {
|
|
return AXTextMarkerToBaseValue(value, indexer);
|
|
@@ -120,6 +122,7 @@
|
|
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
|
|
index 26889c1c6b85a668ba43e723ef223e1a91469f47..e7b01424fab9909b0f210228754afcfed0d51597 100644
|
|
--- a/ui/base/BUILD.gn
|
|
+++ b/ui/base/BUILD.gn
|
|
@@ -355,6 +355,13 @@ component("base") {
|
|
]
|
|
}
|
|
|
|
+ if (is_mas_build) {
|
|
+ sources -= [
|
|
+ "cocoa/remote_accessibility_api.h",
|
|
+ "cocoa/remote_accessibility_api.mm",
|
|
+ ]
|
|
+ }
|
|
+
|
|
if (is_ios) {
|
|
sources += [
|
|
"device_form_factor_ios.mm",
|
|
@@ -510,6 +517,12 @@ component("base") {
|
|
"//url",
|
|
]
|
|
|
|
+ if (is_mac) {
|
|
+ deps += [
|
|
+ "//electron/build/config:generate_mas_config"
|
|
+ ]
|
|
+ }
|
|
+
|
|
if (is_debug || dcheck_always_on) {
|
|
deps += [ "//third_party/re2" ]
|
|
}
|
|
diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h
|
|
index 3182458838aa96d34911280ab4c6c3aa4aa22d6d..6dc85c366b7e61c8bd0302e501c3223a19223313 100644
|
|
--- a/ui/base/cocoa/remote_accessibility_api.h
|
|
+++ b/ui/base/cocoa/remote_accessibility_api.h
|
|
@@ -10,9 +10,12 @@
|
|
#include <vector>
|
|
|
|
#include "base/component_export.h"
|
|
+#include "electron/mas.h"
|
|
|
|
// NSAccessibilityRemoteUIElement is a private class in AppKit.
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
+
|
|
@interface NSAccessibilityRemoteUIElement : NSObject
|
|
+ (void)setRemoteUIApp:(BOOL)flag;
|
|
+ (BOOL)isRemoteUIApp;
|
|
@@ -38,4 +41,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAccessibility {
|
|
|
|
} // 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
|
|
index 59dc2f82214cfd883b6ebef3b0fb25af6387a9cd..912c5252d1b30d943a1552739b9eef9a8eae2d7a 100644
|
|
--- a/ui/base/cocoa/remote_layer_api.h
|
|
+++ b/ui/base/cocoa/remote_layer_api.h
|
|
@@ -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 @@
|
|
|
|
#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.
|
|
@@ -68,6 +70,8 @@ extern NSString* const kCAContextIgnoresHitTest;
|
|
|
|
#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
|
|
index 93e90c4eba9bc9b93d68e834eb6baabeb2d0ecf0..1b90f41d05f847a94adf2f4da827b1d0143b7bcf 100644
|
|
--- a/ui/base/cocoa/remote_layer_api.mm
|
|
+++ b/ui/base/cocoa/remote_layer_api.mm
|
|
@@ -5,18 +5,22 @@
|
|
#include "ui/base/cocoa/remote_layer_api.h"
|
|
|
|
#include "base/feature_list.h"
|
|
+#include "electron/mas.h"
|
|
|
|
#include <objc/runtime.h>
|
|
|
|
namespace ui {
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
namespace {
|
|
// Control use of cross-process CALayers to display content directly from the
|
|
// GPU process on Mac.
|
|
BASE_FEATURE(kRemoteCoreAnimationAPI, base::FEATURE_ENABLED_BY_DEFAULT);
|
|
} // namespace
|
|
+#endif
|
|
|
|
bool RemoteLayerAPISupported() {
|
|
+#if !IS_MAS_BUILD()
|
|
if (!base::FeatureList::IsEnabled(kRemoteCoreAnimationAPI))
|
|
return false;
|
|
|
|
@@ -53,6 +57,9 @@ bool RemoteLayerAPISupported() {
|
|
|
|
// 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
|
|
index c09f41bea0da71a885d682fbb1e678d26f0d0284..aa5d07bd04af4f404026c20821859068c8e131e7 100644
|
|
--- a/ui/display/BUILD.gn
|
|
+++ b/ui/display/BUILD.gn
|
|
@@ -142,6 +142,12 @@ component("display") {
|
|
"//ui/gfx/geometry",
|
|
]
|
|
|
|
+ if (is_mac) {
|
|
+ deps += [
|
|
+ "//electron/build/config:generate_mas_config"
|
|
+ ]
|
|
+ }
|
|
+
|
|
if (is_ios) {
|
|
deps += [ "//build:ios_buildflags" ]
|
|
}
|
|
diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm
|
|
index bfffd0444b0711b201cedaddfd3edaa7b5d9220a..8cdae9f250d407d0c2d34ba7c0891b84f0113fa8 100644
|
|
--- a/ui/display/mac/screen_mac.mm
|
|
+++ b/ui/display/mac/screen_mac.mm
|
|
@@ -29,6 +29,7 @@
|
|
#include "build/build_config.h"
|
|
#include "components/device_event_log/device_event_log.h"
|
|
#include "components/viz/common/resources/shared_image_format.h"
|
|
+#include "electron/mas.h"
|
|
#include "ui/display/display.h"
|
|
#include "ui/display/display_change_notifier.h"
|
|
#include "ui/display/mac/screen_mac_headless.h"
|
|
@@ -179,7 +180,17 @@ DisplayMac BuildDisplayForScreen(NSScreen* screen) {
|
|
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.
|
|
display.set_display_frequency(screen.maximumFramesPerSecond);
|
|
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn
|
|
index f669a4be5809ab0c8bfea92a0ae32a52d3e20f6b..dc5f929f4b82b747fcbf4a5b772fec43c069853a 100644
|
|
--- a/ui/gfx/BUILD.gn
|
|
+++ b/ui/gfx/BUILD.gn
|
|
@@ -284,6 +284,8 @@ component("gfx") {
|
|
"CoreGraphics.framework",
|
|
"CoreText.framework",
|
|
]
|
|
+
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
if (is_ios) {
|
|
sources += [
|
|
diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm
|
|
index bbe355cf69f160866188216cc274d75bd35603db..06ee100d7ea2e892dbf3c0b1adc96c5013ef678a 100644
|
|
--- a/ui/gfx/platform_font_mac.mm
|
|
+++ b/ui/gfx/platform_font_mac.mm
|
|
@@ -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 @@
|
|
|
|
using Weight = Font::Weight;
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
extern "C" {
|
|
bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
|
|
}
|
|
+#endif
|
|
|
|
namespace {
|
|
|
|
@@ -250,7 +253,13 @@ CTFontRef SystemFontForConstructorOfType(
|
|
// 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
|
|
index 1bd7242e935915d201aef63abe41a101c5b51fe9..c6ea05641c994b4bfe7f2eb839071e5a16f8f229 100644
|
|
--- a/ui/views/BUILD.gn
|
|
+++ b/ui/views/BUILD.gn
|
|
@@ -747,6 +747,8 @@ component("views") {
|
|
"IOSurface.framework",
|
|
"QuartzCore.framework",
|
|
]
|
|
+
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
}
|
|
|
|
if (is_win) {
|
|
@@ -1163,6 +1165,8 @@ source_set("test_support") {
|
|
"//ui/base/mojom:ui_base_types",
|
|
]
|
|
|
|
+ deps += ["//electron/build/config:generate_mas_config"]
|
|
+
|
|
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
|
|
index 318bb37f5e065222104ef11c476f6bf7c2758ca1..a7aa661f94df2a435de6727ca89b69e686b92887 100644
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
@@ -19,6 +19,7 @@
|
|
#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"
|
|
@@ -34,7 +35,9 @@
|
|
#include "ui/views/window/dialog_observer.h"
|
|
|
|
@class NativeWidgetMacNSWindow;
|
|
+#if !IS_MAS_BUILD()
|
|
@class NSAccessibilityRemoteUIElement;
|
|
+#endif
|
|
@class NSView;
|
|
|
|
namespace remote_cocoa {
|
|
@@ -517,10 +520,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
|
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
|
|
index 68c472037d3e7f718e928ab8b9256877d247d66e..5f4d37702f25d3b05299562e56e764f3e4838a6a 100644
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
@@ -22,6 +22,7 @@
|
|
#include "components/remote_cocoa/browser/ns_view_ids.h"
|
|
#include "components/remote_cocoa/browser/window.h"
|
|
#include "components/remote_cocoa/common/native_widget_ns_window.mojom.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"
|
|
@@ -378,8 +379,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
if (in_process_ns_window_bridge_) {
|
|
return gfx::NativeViewAccessible(in_process_ns_window_bridge_->ns_view());
|
|
}
|
|
+#if !IS_MAS_BUILD()
|
|
return gfx::NativeViewAccessible(
|
|
(id<NSAccessibility>)remote_view_accessible_);
|
|
+#else
|
|
+ return {};
|
|
+#endif
|
|
}
|
|
|
|
gfx::NativeViewAccessible
|
|
@@ -395,8 +400,12 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
[in_process_ns_window_bridge_->ns_view() window]);
|
|
}
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
return gfx::NativeViewAccessible(
|
|
(id<NSAccessibility>)remote_window_accessible_);
|
|
+#else
|
|
+ return {};
|
|
+#endif
|
|
}
|
|
|
|
remote_cocoa::mojom::NativeWidgetNSWindow*
|
|
@@ -1515,9 +1524,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
// 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.
|
|
if (is_key && is_content_first_responder) {
|
|
@@ -1670,17 +1681,20 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
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_ =
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(view_token);
|
|
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_];
|
|
[remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_];
|
|
+#endif
|
|
}
|
|
|
|
bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
|
|
base::ProcessId* pid,
|
|
std::vector<uint8_t>* token) {
|
|
+#if !IS_MAS_BUILD()
|
|
*pid = getpid();
|
|
id element_id = GetNativeViewAccessible();
|
|
|
|
@@ -1693,6 +1707,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
|
}
|
|
|
|
*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
|
|
index e741b52a4db7ff481fe0f9c6d915465ccad8733d..2dd0d120848e8f2236f20bdaee20dd4b244891ff 100644
|
|
--- a/ui/views/controls/webview/BUILD.gn
|
|
+++ b/ui/views/controls/webview/BUILD.gn
|
|
@@ -48,6 +48,12 @@ component("webview") {
|
|
"//url",
|
|
]
|
|
|
|
+ if (is_mac) {
|
|
+ deps += [
|
|
+ "//electron/build/config:generate_mas_config",
|
|
+ ]
|
|
+ }
|
|
+
|
|
public_deps = [
|
|
"//base",
|
|
"//content/public/browser",
|