diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 5a4f0eef0600..97830b3b9784 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -16,14 +16,7 @@ pepper_plugin_support.patch gtk_visibility.patch resource_file_conflict.patch scroll_bounce_flag.patch -mas_blink_no_private_api.patch -mas_no_private_api.patch -mas-cgdisplayusesforcetogray.patch -mas_disable_remote_layer.patch -mas_disable_remote_accessibility.patch -mas_disable_custom_window_frame.patch -mas_avoid_usage_of_private_macos_apis.patch -mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch +mas_avoid_private_macos_api_usage.patch.patch add_didinstallconditionalfeatures.patch desktop_media_list.patch proxy_config_monitor.patch @@ -111,7 +104,6 @@ fix_on-screen-keyboard_hides_on_input_blur_in_webview.patch preconnect_manager.patch fix_remove_caption-removing_style_call.patch build_allow_electron_to_use_exec_script.patch -build_only_use_the_mas_build_config_in_the_required_components.patch chore_introduce_blocking_api_for_electron.patch chore_patch_out_partition_attribute_dcheck_for_webviews.patch expose_v8initializer_codegenerationcheckcallbackinmainthread.patch diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch index 529f86ca654c..ad20f7a00d74 100644 --- a/patches/chromium/build_gn.patch +++ b/patches/chromium/build_gn.patch @@ -6,15 +6,8 @@ Subject: build_gn.patch These are variables we add to the root BUILDCONFIG so that they're available everywhere, without having to import("//electron/.../flags.gni"). -Additionally, we add the `:mas_build` config to every compiled file so that -the `MAS_BUILD` #define is available everywhere. This produces fewer patch -conflicts when upgrading than it would if we added a specific config dependency -only to those targets which had MAS_BUILD-relevant content in them. The -tradeoff is that switching from MAS_BUILD to !MAS_BUILD or vice-versa will -rebuild the entire tree. - diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 105e194dd1d4d4003736ce5cf963bc1290de669f..7f80b6fab53e62296351695429e3a6b9bb717300 100644 +index 105e194dd1d4d4003736ce5cf963bc1290de669f..420a13c16741037cf81de817c1808603e3fe6490 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { @@ -27,11 +20,3 @@ index 105e194dd1d4d4003736ce5cf963bc1290de669f..7f80b6fab53e62296351695429e3a6b9 # Set to enable the official build level of optimization. This has nothing # to do with branding, but enables an additional level of optimization above # release (!is_debug). This might be better expressed as a tri-state -@@ -352,6 +355,7 @@ default_compiler_configs = [ - "//build/config/compiler/pgo:default_pgo_flags", - "//build/config/coverage:default_coverage", - "//build/config/sanitizers:default_sanitizer_flags", -+ "//electron/build/config:mas_build", - ] - - if (is_win) { diff --git a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch b/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch deleted file mode 100644 index 3d855a3de99a..000000000000 --- a/patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch +++ /dev/null @@ -1,332 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Mon, 14 Nov 2022 01:05:20 -0800 -Subject: build: only use the mas build config in the required components - -Before landing this patch should be split into the relevant MAS patches, or at least the patch this one partially reverts - -diff --git a/base/BUILD.gn b/base/BUILD.gn -index 7f1993c93a8bb21b3ea3917fa4b71118c4307350..84a5643ead19b23abbb5c05cf315ac8fa2401938 100644 ---- a/base/BUILD.gn -+++ b/base/BUILD.gn -@@ -1034,6 +1034,7 @@ component("base") { - "//build/config/compiler:prevent_unsafe_narrowing", - "//build/config/compiler:wexit_time_destructors", - "//build/config/compiler:wglobal_constructors", -+ "//electron/build/config:mas_build", - ] - - deps = [ -diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index 7f80b6fab53e62296351695429e3a6b9bb717300..420a13c16741037cf81de817c1808603e3fe6490 100644 ---- a/build/config/BUILDCONFIG.gn -+++ b/build/config/BUILDCONFIG.gn -@@ -355,7 +355,6 @@ default_compiler_configs = [ - "//build/config/compiler/pgo:default_pgo_flags", - "//build/config/coverage:default_coverage", - "//build/config/sanitizers:default_sanitizer_flags", -- "//electron/build/config:mas_build", - ] - - if (is_win) { -diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn -index 445b70c2f381cde2c540fe386ecd34d30ad973b7..1a8072f6e0456569db8f435248e8051374212b4c 100644 ---- a/components/os_crypt/sync/BUILD.gn -+++ b/components/os_crypt/sync/BUILD.gn -@@ -47,6 +47,7 @@ component("os_crypt") { - "keychain_password_mac.mm", - "os_crypt_mac.mm", - ] -+ configs += ["//electron/build/config:mas_build"] - } - - if (is_win) { -diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn -index 0369b1efab3783c0c61e086f82b3724772e4dff0..11a35c9f611fba4f5313994e41a440658cbe040a 100644 ---- a/components/remote_cocoa/app_shim/BUILD.gn -+++ b/components/remote_cocoa/app_shim/BUILD.gn -@@ -16,6 +16,7 @@ component("app_shim") { - assert(is_mac) - - configs += [ ":app_shim_warnings" ] -+ configs += ["//electron/build/config:mas_build"] - sources = [ - "alert.h", - "alert.mm", -diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 53611e788cde9012ca566444e6c1ee05c99b921e..c5d018ae78b486ef4b3cc86a8091869f62aef534 100644 ---- a/components/viz/service/BUILD.gn -+++ b/components/viz/service/BUILD.gn -@@ -335,6 +335,7 @@ viz_component("service") { - "frame_sinks/external_begin_frame_source_mac.h", - ] - } -+ configs = ["//electron/build/config:mas_build"] - } - - if (is_android || use_ozone) { -@@ -593,6 +594,7 @@ viz_source_set("unit_tests") { - "display_embedder/software_output_device_mac_unittest.mm", - ] - frameworks = [ "IOSurface.framework" ] -+ configs += ["//electron/build/config:mas_build"] - } - - if (is_win) { -diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 264aecf8928c820ac7624d798e834f8056bed405..83afe4327beefdf494f6b822da2f62a1cfb78484 100644 ---- a/content/browser/BUILD.gn -+++ b/content/browser/BUILD.gn -@@ -52,6 +52,7 @@ source_set("browser") { - "//content:content_implementation", - "//v8:external_startup_data", - ] -+ configs += ["//electron/build/config:mas_build"] - defines = [] - libs = [] - frameworks = [] -diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn -index ca5222bd7f79efa305ac1813f0904fb38a627f52..d0714b5630ec9899e792cbf2c406eb98db937dfa 100644 ---- a/content/common/BUILD.gn -+++ b/content/common/BUILD.gn -@@ -182,6 +182,7 @@ source_set("common") { - "//content:content_implementation", - "//build/config:precompiled_headers", - ] -+ configs += ["//electron/build/config:mas_build"] - - public_deps = [ - ":mojo_bindings", -diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn -index 19a85853ced691c017760ebc415d8a78ab5a970b..104fd36fc669db13b4af483f81ef991358df1e8f 100644 ---- a/content/renderer/BUILD.gn -+++ b/content/renderer/BUILD.gn -@@ -224,6 +224,7 @@ target(link_target_type, "renderer") { - } - - configs += [ "//content:content_implementation" ] -+ configs += ["//electron/build/config:mas_build"] - defines = [] - - public_deps = [ -diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn -index 401517d9e298f508781f3b2c8b235483f9cc2a8a..980a1011555cae5ed1fba982cc45985a55884b64 100644 ---- a/content/test/BUILD.gn -+++ b/content/test/BUILD.gn -@@ -482,6 +482,7 @@ static_library("test_support") { - configs += [ - "//build/config:precompiled_headers", - "//v8:external_startup_data", -+ "//electron/build/config:mas_build", - ] - - public_deps = [ -@@ -2916,6 +2917,7 @@ test("content_unittests") { - } - - configs += [ "//build/config:precompiled_headers" ] -+ configs += ["//electron/build/config:mas_build"] - - public_deps = [ "//content:content_resources" ] - -diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn -index 53f5e64a980a83606cf3a350d610118de86807a8..cc84b5f6088a02eecf131cce7c7133e1ceed8c3e 100644 ---- a/content/web_test/BUILD.gn -+++ b/content/web_test/BUILD.gn -@@ -147,6 +147,8 @@ static_library("web_test_browser") { - "browser/web_test_tts_platform.h", - ] - -+ configs += ["//electron/build/config:mas_build"] -+ - if (is_mac) { - sources += [ "browser/web_test_shell_platform_delegate_mac.mm" ] - } else if (toolkit_views && !is_castos) { -diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn -index 6a662873b042a50f052e88bc849e3ef623963961..8b429cb2a5d6cd4555d7d56d3b072b05f87a30e6 100644 ---- a/device/bluetooth/BUILD.gn -+++ b/device/bluetooth/BUILD.gn -@@ -242,6 +242,7 @@ component("bluetooth") { - "IOKit.framework", - "Foundation.framework", - ] -+ configs += ["//electron/build/config:mas_build"] - } - - if (is_mac) { -diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn -index 090bbd6f03c5749aaf763dac9e52c776f366c33d..5143231f5b3c95f55bf12aaedf253781eb59bb64 100644 ---- a/gpu/ipc/service/BUILD.gn -+++ b/gpu/ipc/service/BUILD.gn -@@ -134,6 +134,7 @@ component("service") { - "QuartzCore.framework", - ] - defines += [ "GL_SILENCE_DEPRECATION" ] -+ configs += ["//electron/build/config:mas_build"] - } - if (is_ios) { - sources += [ "image_transport_surface_ios.mm" ] -diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index c07f39acf8a733780b325b17d19718346136712d..c174e10763e8753257c7ebed6eee1fb6df818559 100644 ---- a/media/audio/BUILD.gn -+++ b/media/audio/BUILD.gn -@@ -206,6 +206,7 @@ source_set("audio") { - "CoreMedia.framework", - ] - weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0 -+ configs += ["//electron/build/config:mas_build"] - } - - if (is_ios) { -diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn -index f36bf682ffdeaf69da34a4f9e18465dde4e3a9a3..7f1a6fb71f78855bc771ee533b1715b246899c1c 100644 ---- a/net/dns/BUILD.gn -+++ b/net/dns/BUILD.gn -@@ -177,6 +177,8 @@ source_set("dns") { - ":host_resolver_manager", - ":mdns_client", - ] -+ -+ configs += ["//electron/build/config:mas_build"] - } - - # The standard API of net/dns. -diff --git a/sandbox/mac/BUILD.gn b/sandbox/mac/BUILD.gn -index 299a028f23314f479d2da8f914a5bdf34698d854..672dcb04dd3cf4e3cc71403f727a1dde91ad4402 100644 ---- a/sandbox/mac/BUILD.gn -+++ b/sandbox/mac/BUILD.gn -@@ -39,6 +39,7 @@ component("seatbelt") { - ] - public_deps = [ "//third_party/protobuf:protobuf_lite" ] - defines = [ "SEATBELT_IMPLEMENTATION" ] -+ configs += ["//electron/build/config:mas_build"] - } - - component("seatbelt_extension") { -@@ -52,6 +53,7 @@ component("seatbelt_extension") { - libs = [ "sandbox" ] - public_deps = [ "//base" ] - defines = [ "SEATBELT_IMPLEMENTATION" ] -+ configs += ["//electron/build/config:mas_build"] - } - - component("system_services") { -@@ -66,6 +68,7 @@ component("system_services") { - deps = [ ":seatbelt_export" ] - public_deps = [ "//base" ] - defines = [ "SEATBELT_IMPLEMENTATION" ] -+ configs += ["//electron/build/config:mas_build"] - } - - source_set("sandbox_unittests") { -diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn -index 3c095a52ebca04905445843a536eb92103a326f2..97b413d1283d79af6954de2f04919a11c8e46689 100644 ---- a/third_party/blink/renderer/core/BUILD.gn -+++ b/third_party/blink/renderer/core/BUILD.gn -@@ -312,6 +312,7 @@ component("core") { - configs -= core_config_remove - configs += core_config_add - configs += [ "//v8:external_startup_data" ] -+ configs += ["//electron/build/config:mas_build"] - - public_deps = [ - ":core_generated", -diff --git a/ui/accelerated_widget_mac/BUILD.gn b/ui/accelerated_widget_mac/BUILD.gn -index 3ead42e14ad9d41a30c5637678a3ac49296ce2a6..8dec61ee6a62e54ec3c8c5dd5e08601c28d04dfe 100644 ---- a/ui/accelerated_widget_mac/BUILD.gn -+++ b/ui/accelerated_widget_mac/BUILD.gn -@@ -33,6 +33,8 @@ component("accelerated_widget_mac") { - "QuartzCore.framework", - ] - -+ configs += ["//electron/build/config:mas_build"] -+ - if (is_ios) { - sources += [ "ca_layer_frame_sink_provider.h" ] - } -diff --git a/ui/accessibility/platform/BUILD.gn b/ui/accessibility/platform/BUILD.gn -index 4e23c38763184840a393589b3f55dcabb0db8121..e4ad30d0d7acecdca3a22fe05935a3406d784a95 100644 ---- a/ui/accessibility/platform/BUILD.gn -+++ b/ui/accessibility/platform/BUILD.gn -@@ -251,6 +251,7 @@ component("platform") { - weak_frameworks = [ - "Accessibility.framework", # macOS 11 - ] -+ configs += ["//electron/build/config:mas_build"] - } - - if (use_atk) { -diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 39a960146504ac6034fe24593006d09ff9c667ac..67d0b5c26ef4788559efc696656dc88fc5b7e637 100644 ---- a/ui/base/BUILD.gn -+++ b/ui/base/BUILD.gn -@@ -359,6 +359,7 @@ component("base") { - "interaction/element_tracker_mac.mm", - "resource/resource_bundle_mac.mm", - ] -+ configs += ["//electron/build/config:mas_build"] - } - - if (is_apple) { -diff --git a/ui/display/BUILD.gn b/ui/display/BUILD.gn -index 301e8792b1259e7f7c4eb8e75a09a32f0d60e91f..36da16f203b14e872fb8153e8fc10c3f6725280d 100644 ---- a/ui/display/BUILD.gn -+++ b/ui/display/BUILD.gn -@@ -68,6 +68,10 @@ component("display") { - "mac/display_link_mac.h", - "mac/screen_mac.mm", - ] -+ -+ configs += [ -+ "//electron/build/config:mas_build" -+ ] - } - - if (is_win) { -diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn -index df601fcc40b4b8ca131a4f5a3ced5897075aa0f7..9d2edc62d95f04b6f1b3cd667940b1cb2dc728c3 100644 ---- a/ui/gfx/BUILD.gn -+++ b/ui/gfx/BUILD.gn -@@ -204,6 +204,7 @@ component("gfx") { - "scoped_ns_graphics_context_save_gstate_mac.h", - "scoped_ns_graphics_context_save_gstate_mac.mm", - ] -+ configs += ["//electron/build/config:mas_build"] - } - if (is_win) { - sources += [ -diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn -index e1bc7d4e424a2bcfa51394edf8b22a8711d9ec95..d2e2370658a86c99581d9f4d009af552f71eac94 100644 ---- a/ui/views/BUILD.gn -+++ b/ui/views/BUILD.gn -@@ -697,6 +697,7 @@ component("views") { - "IOSurface.framework", - "QuartzCore.framework", - ] -+ configs += ["//electron/build/config:mas_build"] - } - - if (is_win) { -@@ -1126,6 +1127,8 @@ source_set("test_support") { - "//testing/gtest", - ] - -+ configs += ["//electron/build/config:mas_build"] -+ - if (is_win) { - sources += [ - "test/desktop_window_tree_host_win_test_api.cc", -diff --git a/ui/views/controls/webview/BUILD.gn b/ui/views/controls/webview/BUILD.gn -index e3dd4fab3a1cac0138f8dac60247e0ea3343e87e..f31130eaa3719eda0da5b3f0e8c294775faf6bd4 100644 ---- a/ui/views/controls/webview/BUILD.gn -+++ b/ui/views/controls/webview/BUILD.gn -@@ -19,6 +19,9 @@ component("webview") { - - if (is_mac) { - sources += [ "unhandled_keyboard_event_handler_mac.mm" ] -+ configs += [ -+ "//electron/build/config:mas_build", -+ ] - } - - if (is_win) { diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 1b904a6667e1..93da869111b2 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -90,7 +90,7 @@ index 8af69cac78b7488d28f1f05ccb174793fe5148cd..9f74e511c263d147b5fbe81fe100d217 private: const HWND hwnd_; diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 9e66224b5cdb17a12c447eb67e2b1066d949128e..53611e788cde9012ca566444e6c1ee05c99b921e 100644 +index b0e2c1932e2d6e8a7d68b45dd2928b3a14e2afca..c5d018ae78b486ef4b3cc86a8091869f62aef534 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn @@ -143,6 +143,8 @@ viz_component("service") { diff --git a/patches/chromium/mas-cgdisplayusesforcetogray.patch b/patches/chromium/mas-cgdisplayusesforcetogray.patch deleted file mode 100644 index d57915d47205..000000000000 --- a/patches/chromium/mas-cgdisplayusesforcetogray.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Apthorp -Date: Thu, 20 Sep 2018 17:49:24 -0700 -Subject: mas: avoid usage of CGDisplayUsesForceToGray - -Removes usage of the CGDisplayUsesForceToGray private API. - -diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm -index a771c1c03fd1afe3a5e563b4421721a5ddc2eb93..a6cbdfcbeff30508d921d4637aac543dce9e8ad3 100644 ---- a/ui/display/mac/screen_mac.mm -+++ b/ui/display/mac/screen_mac.mm -@@ -171,7 +171,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. - { diff --git a/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch new file mode 100644 index 000000000000..c4e04cf3a646 --- /dev/null +++ b/patches/chromium/mas_avoid_private_macos_api_usage.patch.patch @@ -0,0 +1,1661 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Samuel Attard +Date: Thu, 20 Sep 2018 17:48:49 -0700 +Subject: mas: avoid private macOS API usage + +* Use the stub killring file when building blink +* Remove usage of the following private APIs + * abort_report_np + * pthread_fchdir_np + * pthread_chdir_np + * SetApplicationIsDaemon + * _LSSetApplicationLaunchServicesServerConnectionStatus + * AreDeviceAndUserJoinedToDomain + * _CFIsObjC + * AudioDeviceDuck + * NSNextStepFrame + * NSThemeFrame + * NSTextInputReplacementRangeAttributeName +* NSAccessibilityRemoteUIElement is unnecessary for Electron's use-case. We use it +for progressive web apps (where the AXTree is in the browser process, but macOS +needs to think it's coming from the PWA process). I think it can just be chopped +out -- if there are any side-effects, we should be able to work around them. +* CAContext removal + * For apps that spend a lot of time watching video (especially fullscreen video), + the power/battery usage will likely increase 1.5x to 2x. For something that is, + e.g, scrolling, it'll be smaller, more like 1.15x or 1.25x. + + In terms of performance, the impact will likely be fairly small -- any app that + could hit 60fps before will likely still be able to hit 60fps. There may even be + cases where performance improves when disabling remote CoreAnimation (remote + CoreAnimation is really only about battery usage). +* CTFontDescriptorIsSystemUIFont is a private API, we're using an +_interesting_ technique in the MAS build to determine if the font is a +system font by checking if it's kCTFontPriorityAttribute is set to +system priority. + +diff --git a/base/BUILD.gn b/base/BUILD.gn +index 7f1993c93a8bb21b3ea3917fa4b71118c4307350..84a5643ead19b23abbb5c05cf315ac8fa2401938 100644 +--- a/base/BUILD.gn ++++ b/base/BUILD.gn +@@ -1034,6 +1034,7 @@ component("base") { + "//build/config/compiler:prevent_unsafe_narrowing", + "//build/config/compiler:wexit_time_destructors", + "//build/config/compiler:wglobal_constructors", ++ "//electron/build/config:mas_build", + ] + + deps = [ +diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm +index 2bad2ed2f5205b3a2599aa3a620812aa32d52f87..ab3d4c953556d4f94075671436565a6c442f30d5 100644 +--- a/base/enterprise_util_mac.mm ++++ b/base/enterprise_util_mac.mm +@@ -115,6 +115,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) { +@@ -218,5 +226,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() { + + return state; + } ++#endif + + } // namespace base +diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc +index b267bc2272fa82334a70d897a900f1ea37b1a598..967e22699bf565368704972c021f9b425a570f08 100644 +--- a/base/process/launch_mac.cc ++++ b/base/process/launch_mac.cc +@@ -21,13 +21,18 @@ + #include "base/threading/scoped_blocking_call.h" + #include "base/threading/thread_restrictions.h" + #include "base/trace_event/base_tracing.h" ++#if IS_MAS_BUILD() ++#include ++#endif + + 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); +@@ -99,13 +104,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 + +@@ -226,7 +245,7 @@ Process LaunchProcess(const std::vector& argv, + file_actions.Inherit(STDERR_FILENO); + } + +-#if BUILDFLAG(IS_MAC) ++#if 0 + if (options.disclaim_responsibility) { + DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1)); + } +diff --git a/base/process/process_info_mac.cc b/base/process/process_info_mac.cc +index 94a028be3c315edc0056408ab9ab41b6b001a1c1..0d830234edb5621f57e39f4a951d357a23f677c1 100644 +--- a/base/process/process_info_mac.cc ++++ b/base/process/process_info_mac.cc +@@ -8,15 +8,21 @@ + #include + #include + ++#if !IS_MAS_BUILD() + extern "C" { + pid_t responsibility_get_pid_responsible_for_pid(pid_t); + } ++#endif + + namespace base { + + bool IsProcessSelfResponsible() { ++#if !IS_MAS_BUILD() + const pid_t pid = getpid(); + return responsibility_get_pid_responsible_for_pid(pid) == pid; ++#else ++ return true; ++#endif + } + + } // namespace base +diff --git a/components/os_crypt/sync/BUILD.gn b/components/os_crypt/sync/BUILD.gn +index 445b70c2f381cde2c540fe386ecd34d30ad973b7..1a8072f6e0456569db8f435248e8051374212b4c 100644 +--- a/components/os_crypt/sync/BUILD.gn ++++ b/components/os_crypt/sync/BUILD.gn +@@ -47,6 +47,7 @@ component("os_crypt") { + "keychain_password_mac.mm", + "os_crypt_mac.mm", + ] ++ configs += ["//electron/build/config:mas_build"] + } + + if (is_win) { +diff --git a/components/remote_cocoa/app_shim/BUILD.gn b/components/remote_cocoa/app_shim/BUILD.gn +index 0369b1efab3783c0c61e086f82b3724772e4dff0..11a35c9f611fba4f5313994e41a440658cbe040a 100644 +--- a/components/remote_cocoa/app_shim/BUILD.gn ++++ b/components/remote_cocoa/app_shim/BUILD.gn +@@ -16,6 +16,7 @@ component("app_shim") { + assert(is_mac) + + configs += [ ":app_shim_warnings" ] ++ configs += ["//electron/build/config:mas_build"] + sources = [ + "alert.h", + "alert.mm", +diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm +index 5a096477c123a782341115f964c4975301ccaf9a..ecfbb3b405425af346a6ba6788fc1d8ff89760cd 100644 +--- a/components/remote_cocoa/app_shim/application_bridge.mm ++++ b/components/remote_cocoa/app_shim/application_bridge.mm +@@ -51,6 +51,7 @@ + + // NativeWidgetNSWindowHostHelper: + id GetNativeViewAccessible() override { ++#if !IS_MAS_BUILD() + if (!remote_accessibility_element_) { + int64_t browser_pid = 0; + std::vector element_token; +@@ -61,6 +62,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; +@@ -99,7 +103,9 @@ void GetWordAt(const gfx::Point& location_in_content, + mojo::AssociatedRemote text_input_host_remote_; + + std::unique_ptr bridge_; ++#if !IS_MAS_BUILD() + NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_; ++#endif + }; + + } // namespace +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 b8eb13a42aa41143412b9a01f2716a3608b968fb..8eaccd4ce7e484aef1b4517935bc4ba2fa4a1ea4 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,6 +9,7 @@ + #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h" + #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h" + ++#if !IS_MAS_BUILD() + @interface NSWindow (PrivateBrowserNativeWidgetAPI) + + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; + @end +@@ -65,10 +66,13 @@ - (BOOL)_shouldCenterTrafficLights { + + @end + ++#endif // MAS_BUILD ++ + @implementation BrowserNativeWidgetWindow + + // 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]) +@@ -115,6 +119,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. +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..dbbebbdc1735bc14224dfcde0b7fe3a6fd9f9e40 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,8 @@ + + #import "components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.h" + ++#if !IS_MAS_BUILD() ++ + @interface NSWindow (PrivateAPI) + + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; + @end +@@ -18,8 +20,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 +33,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 085d9821933390c781fe11d441910501bf22d601..6c79434e2a5b59267c9801ac23c318c9c320f019 100644 +--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h ++++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h +@@ -17,6 +17,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 +@@ -33,6 +34,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 6e837d66209e6322324227bc596e40e56fccc495..3c3c5db57cfaba8e59867e74b81b4fad1cf7a8ed 100644 +--- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm ++++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm +@@ -101,7 +101,9 @@ void OrderChildWindow(NSWindow* child_window, + } // namespace + + @interface NSWindow (Private) ++#if !IS_MAS_BUILD() + + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle; ++#endif + - (BOOL)hasKeyAppearance; + - (long long)_resizeDirectionForMouseLocation:(CGPoint)location; + - (BOOL)_isConsideredOpenForPersistentState; +@@ -139,6 +141,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event { + } + @end + ++#if !IS_MAS_BUILD() ++ + @implementation NativeWidgetMacNSWindowTitledFrame + - (void)mouseDown:(NSEvent*)event { + if (self.window.isMovable) +@@ -165,6 +169,8 @@ - (BOOL)usesCustomDrawing { + } + @end + ++#endif // MAS_BUILD ++ + @implementation NativeWidgetMacNSWindow { + @private + CommandDispatcher* __strong _commandDispatcher; +@@ -353,6 +359,8 @@ - (NSAccessibilityRole)accessibilityRole { + + // NSWindow overrides. + ++#if !IS_MAS_BUILD() ++ + + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { + if (windowStyle & NSWindowStyleMaskTitled) { + if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class]) +@@ -364,6 +372,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { + return [super frameViewClassForStyleMask:windowStyle]; + } + ++#endif ++ + - (BOOL)_isTitleHidden { + bool shouldShowWindowTitle = YES; + if (_bridge) +diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +index 053b8a2182778b469941116eab3acd5fd6fd8099..d085258d5970b37215fe0d5591e6c0306401a172 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 +@@ -600,10 +600,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 +diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn +index 9e66224b5cdb17a12c447eb67e2b1066d949128e..b0e2c1932e2d6e8a7d68b45dd2928b3a14e2afca 100644 +--- a/components/viz/service/BUILD.gn ++++ b/components/viz/service/BUILD.gn +@@ -333,6 +333,7 @@ viz_component("service") { + "frame_sinks/external_begin_frame_source_mac.h", + ] + } ++ configs = ["//electron/build/config:mas_build"] + } + + if (is_android || use_ozone) { +@@ -591,6 +592,7 @@ viz_source_set("unit_tests") { + "display_embedder/software_output_device_mac_unittest.mm", + ] + frameworks = [ "IOSurface.framework" ] ++ configs += ["//electron/build/config:mas_build"] + } + + 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 76be676717e62c429319338c6115be89f2dfa424..18a5fd3c87b08c95d668b70c9b8f7a76413a75bb 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 +@@ -86,8 +86,10 @@ id GetFocusedBrowserAccessibilityElement() override { + return nil; + } + void SetAccessibilityWindow(NSWindow* window) override { ++#if !IS_MAS_BUILD() + host_->SetRemoteAccessibilityWindowToken( + ui::RemoteAccessibility::GetTokenForLocalElement(window)); ++#endif + } + + void ForwardKeyboardEvent(const content::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 47afd2553bf76b5b185a4be131196d90cf9cad44..d6f9998890d7a83a8fb221691aa2f1e761461d52 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 +@@ -2019,15 +2019,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 34e00e884f05ed43d6966372479d268ac4b681ed..f88d207fc9c8d831334ef0c761099799ed3928d8 100644 +--- a/content/browser/BUILD.gn ++++ b/content/browser/BUILD.gn +@@ -52,6 +52,7 @@ source_set("browser") { + "//content:content_implementation", + "//v8:external_startup_data", + ] ++ configs += ["//electron/build/config:mas_build"] + defines = [] + libs = [] + frameworks = [] +diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm +index 5a6706495ed2a8f1cd781da9bde8572318bf6897..afd4d1f728a7f056e49b2ecb006c5a05388d3409 100644 +--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm ++++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm +@@ -21,7 +21,9 @@ + #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" + #include "ui/accessibility/ax_role_properties.h" + #include "ui/accessibility/platform/ax_private_webkit_constants_mac.h" ++#if !IS_MAS_BUILD() + #include "ui/base/cocoa/remote_accessibility_api.h" ++#endif + + namespace { + +@@ -224,6 +226,7 @@ void PostAnnouncementNotification(NSString* announcement, + return; + } + ++#if !IS_MAS_BUILD() + BrowserAccessibilityManager* root_manager = GetManagerForRootFrame(); + if (root_manager) { + BrowserAccessibilityManagerMac* root_manager_mac = +@@ -246,6 +249,7 @@ void PostAnnouncementNotification(NSString* announcement, + return; + } + } ++#endif + + // Use native VoiceOver support for live regions. + BrowserAccessibilityCocoa* retained_node = native_node; +@@ -632,6 +636,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 +@@ -660,6 +665,7 @@ void PostAnnouncementNotification(NSString* announcement, + if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) { + return true; + } ++#endif + + return false; + } +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 90d8ab3119b469e62ca771aaeb3d6b5c13d79775..825d46c85a44adb68adefe4adc0dd926e71c9129 100644 +--- a/content/browser/renderer_host/render_widget_host_view_mac.h ++++ b/content/browser/renderer_host/render_widget_host_view_mac.h +@@ -50,7 +50,9 @@ class ScopedPasswordInputEnabler; + + @protocol RenderWidgetHostViewMacDelegate; + ++#if !IS_MAS_BUILD() + @class NSAccessibilityRemoteUIElement; ++#endif + @class RenderWidgetHostViewCocoa; + @class CursorAccessibilityScaleFactorObserver; + +@@ -676,9 +678,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 c260544133059b2104c1185b4708494ff1bde286..0d752ae48eb5f822dd80c369b726a7d411d71c78 100644 +--- a/content/browser/renderer_host/render_widget_host_view_mac.mm ++++ b/content/browser/renderer_host/render_widget_host_view_mac.mm +@@ -272,8 +272,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. +@@ -1639,8 +1641,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, + + gfx::NativeViewAccessible + RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { ++#if !IS_MAS_BUILD() + if (remote_window_accessible_) + return remote_window_accessible_; ++#endif + return [GetInProcessNSView() window]; + } + +@@ -1685,9 +1689,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( +@@ -2194,12 +2200,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, + + void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken( + const std::vector& 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 ca5222bd7f79efa305ac1813f0904fb38a627f52..d0714b5630ec9899e792cbf2c406eb98db937dfa 100644 +--- a/content/common/BUILD.gn ++++ b/content/common/BUILD.gn +@@ -182,6 +182,7 @@ source_set("common") { + "//content:content_implementation", + "//build/config:precompiled_headers", + ] ++ configs += ["//electron/build/config:mas_build"] + + public_deps = [ + ":mojo_bindings", +diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn +index 19a85853ced691c017760ebc415d8a78ab5a970b..104fd36fc669db13b4af483f81ef991358df1e8f 100644 +--- a/content/renderer/BUILD.gn ++++ b/content/renderer/BUILD.gn +@@ -224,6 +224,7 @@ target(link_target_type, "renderer") { + } + + configs += [ "//content:content_implementation" ] ++ configs += ["//electron/build/config:mas_build"] + defines = [] + + public_deps = [ +diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm +index d4db3b179725cb96bcbd0f73db7d52ef8b7522db..6afbf1defb0591d9fe59a81e6c74746d3e15f081 100644 +--- a/content/renderer/renderer_main_platform_delegate_mac.mm ++++ b/content/renderer/renderer_main_platform_delegate_mac.mm +@@ -10,9 +10,11 @@ + #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 +24,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 +33,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 a119b4439bfb9218c7aaf09dca8e78527da7f20d..faa813b003940280c6eeb87e70173019bdd5280c 100644 +--- a/content/renderer/theme_helper_mac.mm ++++ b/content/renderer/theme_helper_mac.mm +@@ -8,10 +8,11 @@ + + #include "base/strings/sys_string_conversions.h" + ++#if !IS_MAS_BUILD() + extern "C" { + bool CGFontRenderingGetFontSmoothingDisabled(void); + } +- ++#endif + namespace content { + + void SystemColorsDidChange(int aqua_color_variant) { +@@ -24,8 +25,18 @@ void SystemColorsDidChange(int aqua_color_variant) { + } + + 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 401517d9e298f508781f3b2c8b235483f9cc2a8a..980a1011555cae5ed1fba982cc45985a55884b64 100644 +--- a/content/test/BUILD.gn ++++ b/content/test/BUILD.gn +@@ -482,6 +482,7 @@ static_library("test_support") { + configs += [ + "//build/config:precompiled_headers", + "//v8:external_startup_data", ++ "//electron/build/config:mas_build", + ] + + public_deps = [ +@@ -2916,6 +2917,7 @@ test("content_unittests") { + } + + configs += [ "//build/config:precompiled_headers" ] ++ configs += ["//electron/build/config:mas_build"] + + public_deps = [ "//content:content_resources" ] + +diff --git a/content/web_test/BUILD.gn b/content/web_test/BUILD.gn +index 53f5e64a980a83606cf3a350d610118de86807a8..cc84b5f6088a02eecf131cce7c7133e1ceed8c3e 100644 +--- a/content/web_test/BUILD.gn ++++ b/content/web_test/BUILD.gn +@@ -147,6 +147,8 @@ static_library("web_test_browser") { + "browser/web_test_tts_platform.h", + ] + ++ configs += ["//electron/build/config:mas_build"] ++ + if (is_mac) { + sources += [ "browser/web_test_shell_platform_delegate_mac.mm" ] + } else if (toolkit_views && !is_castos) { +diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn +index 6a662873b042a50f052e88bc849e3ef623963961..8b429cb2a5d6cd4555d7d56d3b072b05f87a30e6 100644 +--- a/device/bluetooth/BUILD.gn ++++ b/device/bluetooth/BUILD.gn +@@ -242,6 +242,7 @@ component("bluetooth") { + "IOKit.framework", + "Foundation.framework", + ] ++ configs += ["//electron/build/config:mas_build"] + } + + if (is_mac) { +diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm +index 37ce08d9c11de4e53dbf9a9db2e74f1b12adafcf..bb9433fcb49d40adbe9ef8fdddfde49fc2809a78 100644 +--- a/device/bluetooth/bluetooth_adapter_mac.mm ++++ b/device/bluetooth/bluetooth_adapter_mac.mm +@@ -37,6 +37,7 @@ + #include "device/bluetooth/bluetooth_socket_mac.h" + #include "device/bluetooth/public/cpp/bluetooth_address.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 +@@ -50,6 +51,7 @@ + // [4] https://support.apple.com/kb/PH25091 + void IOBluetoothPreferenceSetControllerPowerState(int state); + } ++#endif + + namespace { + +@@ -93,8 +95,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 + classic_discovery_manager_( + BluetoothDiscoveryManagerMac::CreateClassic(this)), + device_paired_status_callback_( +@@ -244,8 +248,12 @@ bool IsDeviceSystemPaired(const std::string& device_address) { + } + + bool BluetoothAdapterMac::SetPoweredImpl(bool powered) { ++#if !IS_MAS_BUILD() + power_state_function_.Run(base::strict_cast(powered)); + return true; ++#else ++ return false; ++#endif + } + + base::WeakPtr +diff --git a/gpu/ipc/service/BUILD.gn b/gpu/ipc/service/BUILD.gn +index 090bbd6f03c5749aaf763dac9e52c776f366c33d..5143231f5b3c95f55bf12aaedf253781eb59bb64 100644 +--- a/gpu/ipc/service/BUILD.gn ++++ b/gpu/ipc/service/BUILD.gn +@@ -134,6 +134,7 @@ component("service") { + "QuartzCore.framework", + ] + defines += [ "GL_SILENCE_DEPRECATION" ] ++ configs += ["//electron/build/config:mas_build"] + } + 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 d1deb3d7d7d587b36bc8c19cf3f331a0ec6764dd..263c5f3446dab67b9f8d3be4d08eadbaa749dc1d 100644 +--- a/gpu/ipc/service/image_transport_surface_overlay_mac.h ++++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h +@@ -23,7 +23,9 @@ + #include "ui/display/types/display_constants.h" + #endif + ++#if !IS_MAS_BUILD() + @class CAContext; ++#endif + @class CALayer; + + namespace ui { +@@ -76,8 +78,10 @@ class ImageTransportSurfaceOverlayMacEGL : public gl::Presenter { + const gfx::PresentationFeedback& feedback); + void PopulateCALayerParameters(); + ++#if !IS_MAS_BUILD() + const bool use_remote_layer_api_; + CAContext* __strong ca_context_; ++#endif + std::unique_ptr ca_layer_tree_coordinator_; + + gfx::Size pixel_size_; +diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm +index caa7b447f79d837f100b3ee8bb4063145811b9bc..5c510fafb2891759cc12711286e3c34f994411bd 100644 +--- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm ++++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm +@@ -52,12 +52,16 @@ + } // namespace + + ImageTransportSurfaceOverlayMacEGL::ImageTransportSurfaceOverlayMacEGL() +- : use_remote_layer_api_(ui::RemoteLayerAPISupported()), ++ : ++#if !IS_MAS_BUILD() ++ use_remote_layer_api_(ui::RemoteLayerAPISupported()), ++#endif + scale_factor_(1), + weak_ptr_factory_(this) { + static bool av_disabled_at_command_line = + !base::FeatureList::IsEnabled(kAVFoundationOverlays); + ++#if !IS_MAS_BUILD() + ca_layer_tree_coordinator_ = std::make_unique( + use_remote_layer_api_, !av_disabled_at_command_line); + +@@ -78,6 +82,10 @@ + #endif + ca_context_.layer = ca_layer_tree_coordinator_->GetCALayerForDisplay(); + } ++#else ++ ca_layer_tree_coordinator_ = std::make_unique( ++ /*allow_remote_layers=*/false, !av_disabled_at_command_line); ++#endif + } + + ImageTransportSurfaceOverlayMacEGL::~ImageTransportSurfaceOverlayMacEGL() { +@@ -195,9 +203,13 @@ + TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD, + "GLImpl", static_cast(gl::GetGLImplementation()), + "width", pixel_size_.width()); ++#if !IS_MAS_BUILD() + if (use_remote_layer_api_) { + params.ca_context_id = [ca_context_ contextId]; + } else { ++#else ++ if (true) { ++#endif + IOSurfaceRef io_surface = + ca_layer_tree_coordinator_->GetIOSurfaceForDisplay(); + if (io_surface) { +diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn +index c07f39acf8a733780b325b17d19718346136712d..c174e10763e8753257c7ebed6eee1fb6df818559 100644 +--- a/media/audio/BUILD.gn ++++ b/media/audio/BUILD.gn +@@ -206,6 +206,7 @@ source_set("audio") { + "CoreMedia.framework", + ] + weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0 ++ configs += ["//electron/build/config:mas_build"] + } + + if (is_ios) { +diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc +index 34935789d56a6f65926599f053a7bc1b2020ad12..67270c5c75492e9d4c91d33a1eca5caf1cc43ace 100644 +--- a/media/audio/mac/audio_low_latency_input_mac.cc ++++ b/media/audio/mac/audio_low_latency_input_mac.cc +@@ -30,19 +30,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 +diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc +index b3e06372457f57a8c835a790691d8f492baecdec..b27691313cb15d663c903d05cdef20e44270c690 100644 +--- a/media/audio/mac/audio_manager_mac.cc ++++ b/media/audio/mac/audio_manager_mac.cc +@@ -991,7 +991,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( + + void AudioManagerMac::InitializeOnAudioThread() { + DCHECK(GetTaskRunner()->BelongsToCurrentThread()); +- InitializeCoreAudioDispatchOverride(); ++ // InitializeCoreAudioDispatchOverride(); + power_observer_ = std::make_unique(); + } + +diff --git a/net/dns/BUILD.gn b/net/dns/BUILD.gn +index f36bf682ffdeaf69da34a4f9e18465dde4e3a9a3..7f1a6fb71f78855bc771ee533b1715b246899c1c 100644 +--- a/net/dns/BUILD.gn ++++ b/net/dns/BUILD.gn +@@ -177,6 +177,8 @@ source_set("dns") { + ":host_resolver_manager", + ":mdns_client", + ] ++ ++ configs += ["//electron/build/config:mas_build"] + } + + # 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 a93e7cd74d2a9d692304ecf10279fae8e96bb695..3506d6ca555701bad6623cc1c614e0081892e42b 100644 +--- a/net/dns/dns_config_service_posix.cc ++++ b/net/dns/dns_config_service_posix.cc +@@ -130,8 +130,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."; +@@ -148,6 +148,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 299a028f23314f479d2da8f914a5bdf34698d854..672dcb04dd3cf4e3cc71403f727a1dde91ad4402 100644 +--- a/sandbox/mac/BUILD.gn ++++ b/sandbox/mac/BUILD.gn +@@ -39,6 +39,7 @@ component("seatbelt") { + ] + public_deps = [ "//third_party/protobuf:protobuf_lite" ] + defines = [ "SEATBELT_IMPLEMENTATION" ] ++ configs += ["//electron/build/config:mas_build"] + } + + component("seatbelt_extension") { +@@ -52,6 +53,7 @@ component("seatbelt_extension") { + libs = [ "sandbox" ] + public_deps = [ "//base" ] + defines = [ "SEATBELT_IMPLEMENTATION" ] ++ configs += ["//electron/build/config:mas_build"] + } + + component("system_services") { +@@ -66,6 +68,7 @@ component("system_services") { + deps = [ ":seatbelt_export" ] + public_deps = [ "//base" ] + defines = [ "SEATBELT_IMPLEMENTATION" ] ++ configs += ["//electron/build/config:mas_build"] + } + + source_set("sandbox_unittests") { +diff --git a/sandbox/mac/sandbox_compiler.cc b/sandbox/mac/sandbox_compiler.cc +index f35d9ef2a2df3db8ecbf1d7b909c7b1cf33f3cd9..a710b8b4f851666fd65bb37f69ec2fa70259697b 100644 +--- a/sandbox/mac/sandbox_compiler.cc ++++ b/sandbox/mac/sandbox_compiler.cc +@@ -47,6 +47,7 @@ bool SandboxCompiler::SetParameter(const std::string& key, + } + + bool SandboxCompiler::CompileAndApplyProfile(std::string& error) { ++#if !IS_MAS_BUILD() + if (mode_ == Target::kSource) { + std::vector params; + +@@ -67,6 +68,9 @@ bool SandboxCompiler::CompileAndApplyProfile(std::string& error) { + } + } + return false; ++#else ++ return true; ++#endif + } + + bool SandboxCompiler::CompilePolicyToProto(mac::SandboxPolicy& policy, +diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc +index 095c639b9893e885d8937e29ed7d47a7c28bc6b6..cfa5e307de8326fbc335996feaf9595d1572cd3d 100644 +--- a/sandbox/mac/sandbox_logging.cc ++++ b/sandbox/mac/sandbox_logging.cc +@@ -33,9 +33,11 @@ + } + #endif + ++#if !IS_MAS_BUILD() + extern "C" { + void abort_report_np(const char*, ...); + } ++#endif + + namespace sandbox::logging { + +@@ -76,9 +78,11 @@ void SendOsLog(Level level, const char* message) { + sandbox::crash_message::SetCrashMessage(message); + } + ++#if !IS_MAS_BUILD() + if (level == Level::FATAL) { + abort_report_np(message); + } ++#endif + } + + // |error| is strerror(errno) when a P* logging function is called. Pass +diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc +index 15c835e118456394c0a00ac98c11241c14ca75bd..83759e5fbc252fa57ca2fa122873dfac3d61d46d 100644 +--- a/sandbox/mac/seatbelt.cc ++++ b/sandbox/mac/seatbelt.cc +@@ -9,7 +9,7 @@ + + extern "C" { + #include +- ++#if !IS_MAS_BUILD() + int sandbox_init_with_parameters(const char* profile, + uint64_t flags, + const char* const parameters[], +@@ -40,13 +40,13 @@ 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() + bool HandleSandboxResult(int rv, char* errorbuf, std::string* error) { + if (rv == 0) { + if (error) +@@ -74,36 +74,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. +@@ -114,6 +126,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 +@@ -122,6 +135,9 @@ bool Seatbelt::Init(const char* profile, uint64_t flags, std::string* error) { + int rv = ::sandbox_init(profile, flags, &errorbuf); + return HandleSandboxResult(rv, errorbuf, error); + #pragma clang diagnostic pop ++#else ++ return true; ++#endif + } + + // static +@@ -129,10 +145,14 @@ bool Seatbelt::InitWithParams(const char* profile, + uint64_t flags, + const char* const parameters[], + std::string* error) { ++#if !IS_MAS_BUILD() + char* errorbuf = nullptr; + int rv = + ::sandbox_init_with_parameters(profile, flags, parameters, &errorbuf); + return HandleSandboxResult(rv, errorbuf, error); ++#else ++ return true; ++#endif + } + + // static +@@ -140,6 +160,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); +@@ -149,33 +170,44 @@ bool Seatbelt::Compile(const char* profile, + compiled_profile.assign(reinterpret_cast(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(profile.data()), + .size = profile.size()}; + return HandleSandboxErrno(::sandbox_apply(&sbox_profile), + "sandbox_apply: ", error); ++#else ++ return true; ++#endif + } + + // static + void Seatbelt::FreeError(char* errorbuf) { ++#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 + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + return ::sandbox_free_error(errorbuf); + #pragma clang diagnostic pop ++#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 18479382a277cb2b25626ec8d31442bfd1377ee6..7d80d7fa8337523c3a70f317f883f0cc26c6f40b 100644 +--- a/sandbox/mac/seatbelt_extension.cc ++++ b/sandbox/mac/seatbelt_extension.cc +@@ -11,6 +11,7 @@ + #include "base/notreached.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 +23,7 @@ char* sandbox_extension_issue_file(const char* type, + const char* path, + uint32_t flags); + } ++#endif + + namespace sandbox { + +@@ -50,7 +52,11 @@ std::unique_ptr 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 +68,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 +90,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(); + return nullptr; +diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc +index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..dc30306f2c5d20503399fc3a8860773aa0044352 100644 +--- a/sandbox/mac/system_services.cc ++++ b/sandbox/mac/system_services.cc +@@ -9,6 +9,7 @@ + + #include "base/apple/osstatus_logging.h" + ++#if !IS_MAS_BUILD() + extern "C" { + OSStatus SetApplicationIsDaemon(Boolean isDaemon); + void _LSSetApplicationLaunchServicesServerConnectionStatus( +@@ -19,10 +20,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 +39,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 3c095a52ebca04905445843a536eb92103a326f2..97b413d1283d79af6954de2f04919a11c8e46689 100644 +--- a/third_party/blink/renderer/core/BUILD.gn ++++ b/third_party/blink/renderer/core/BUILD.gn +@@ -312,6 +312,7 @@ component("core") { + configs -= core_config_remove + configs += core_config_add + configs += [ "//v8:external_startup_data" ] ++ configs += ["//electron/build/config:mas_build"] + + public_deps = [ + ":core_generated", +diff --git a/third_party/blink/renderer/core/editing/build.gni b/third_party/blink/renderer/core/editing/build.gni +index 0e58db44e208e7aa1f4a1f9a27ed8bc7d9bd8205..a7cc2154ffeb5229e4ea59c6fc4964b6b1c23f85 100644 +--- a/third_party/blink/renderer/core/editing/build.gni ++++ b/third_party/blink/renderer/core/editing/build.gni +@@ -354,10 +354,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/ui/accelerated_widget_mac/BUILD.gn b/ui/accelerated_widget_mac/BUILD.gn +index 3ead42e14ad9d41a30c5637678a3ac49296ce2a6..8dec61ee6a62e54ec3c8c5dd5e08601c28d04dfe 100644 +--- a/ui/accelerated_widget_mac/BUILD.gn ++++ b/ui/accelerated_widget_mac/BUILD.gn +@@ -33,6 +33,8 @@ component("accelerated_widget_mac") { + "QuartzCore.framework", + ] + ++ configs += ["//electron/build/config:mas_build"] ++ + if (is_ios) { + sources += [ "ca_layer_frame_sink_provider.h" ] + } +diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated_widget_mac/display_ca_layer_tree.mm +index dcf493d62990018040a3f84b6f875af737bd2214..6ffffe8b3946e0427aead8be19878c537c841294 100644 +--- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm ++++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm +@@ -121,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; +@@ -150,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 4e23c38763184840a393589b3f55dcabb0db8121..e4ad30d0d7acecdca3a22fe05935a3406d784a95 100644 +--- a/ui/accessibility/platform/BUILD.gn ++++ b/ui/accessibility/platform/BUILD.gn +@@ -251,6 +251,7 @@ component("platform") { + weak_frameworks = [ + "Accessibility.framework", # macOS 11 + ] ++ configs += ["//electron/build/config:mas_build"] + } + + if (use_atk) { +diff --git a/ui/accessibility/platform/inspect/ax_transform_mac.mm b/ui/accessibility/platform/inspect/ax_transform_mac.mm +index c737a2ca1afb44083aef33c6aa4518bea68d1aba..879f1357b5129849c5a1aa1731cf769712569e9e 100644 +--- a/ui/accessibility/platform/inspect/ax_transform_mac.mm ++++ b/ui/accessibility/platform/inspect/ax_transform_mac.mm +@@ -108,6 +108,7 @@ + } + } + ++#if !IS_MAS_BUILD() + // AXTextMarker + if (IsAXTextMarker(value)) { + return AXTextMarkerToBaseValue(value, indexer); +@@ -117,6 +118,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 3af6a66b319a17f7a5962a3135358dfa3ca5fa00..67d0b5c26ef4788559efc696656dc88fc5b7e637 100644 +--- a/ui/base/BUILD.gn ++++ b/ui/base/BUILD.gn +@@ -359,6 +359,7 @@ component("base") { + "interaction/element_tracker_mac.mm", + "resource/resource_bundle_mac.mm", + ] ++ configs += ["//electron/build/config:mas_build"] + } + + if (is_apple) { +@@ -376,6 +377,13 @@ component("base") { + sources += [ "resource/resource_bundle_lacros.cc" ] + } + ++ if (is_mas_build) { ++ sources -= [ ++ "cocoa/remote_accessibility_api.h", ++ "cocoa/remote_accessibility_api.mm", ++ ] ++ } ++ + if (is_ios) { + sources += [ + "device_form_factor_ios.mm", +diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h +index 3182458838aa96d34911280ab4c6c3aa4aa22d6d..17b57f54492421743a0d69106eefce2c9beb8e87 100644 +--- a/ui/base/cocoa/remote_accessibility_api.h ++++ b/ui/base/cocoa/remote_accessibility_api.h +@@ -13,6 +13,8 @@ + + // NSAccessibilityRemoteUIElement is a private class in AppKit. + ++#if !IS_MAS_BUILD() ++ + @interface NSAccessibilityRemoteUIElement : NSObject + + (void)setRemoteUIApp:(BOOL)flag; + + (BOOL)isRemoteUIApp; +@@ -38,4 +40,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..d585ba14b34021a93c878d0d9f9d9ef70eed32ca 100644 +--- a/ui/base/cocoa/remote_layer_api.h ++++ b/ui/base/cocoa/remote_layer_api.h +@@ -17,6 +17,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 +69,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 fc25ba79d2b0e1acdb7ba54b89e7d6e16f94771b..962df2d65d61ec0836cf465d847eb666033846f2 100644 +--- a/ui/base/cocoa/remote_layer_api.mm ++++ b/ui/base/cocoa/remote_layer_api.mm +@@ -10,6 +10,7 @@ + + namespace ui { + ++#if !IS_MAS_BUILD() + namespace { + // Control use of cross-process CALayers to display content directly from the + // GPU process on Mac. +@@ -17,8 +18,10 @@ + "RemoteCoreAnimationAPI", + base::FEATURE_ENABLED_BY_DEFAULT); + } // namespace ++#endif + + bool RemoteLayerAPISupported() { ++#if !IS_MAS_BUILD() + if (!base::FeatureList::IsEnabled(kRemoteCoreAnimationAPI)) + return false; + +@@ -55,6 +58,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 301e8792b1259e7f7c4eb8e75a09a32f0d60e91f..36da16f203b14e872fb8153e8fc10c3f6725280d 100644 +--- a/ui/display/BUILD.gn ++++ b/ui/display/BUILD.gn +@@ -68,6 +68,10 @@ component("display") { + "mac/display_link_mac.h", + "mac/screen_mac.mm", + ] ++ ++ configs += [ ++ "//electron/build/config:mas_build" ++ ] + } + + if (is_win) { +diff --git a/ui/display/mac/screen_mac.mm b/ui/display/mac/screen_mac.mm +index a771c1c03fd1afe3a5e563b4421721a5ddc2eb93..a6cbdfcbeff30508d921d4637aac543dce9e8ad3 100644 +--- a/ui/display/mac/screen_mac.mm ++++ b/ui/display/mac/screen_mac.mm +@@ -171,7 +171,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. + { +diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn +index df601fcc40b4b8ca131a4f5a3ced5897075aa0f7..9d2edc62d95f04b6f1b3cd667940b1cb2dc728c3 100644 +--- a/ui/gfx/BUILD.gn ++++ b/ui/gfx/BUILD.gn +@@ -204,6 +204,7 @@ component("gfx") { + "scoped_ns_graphics_context_save_gstate_mac.h", + "scoped_ns_graphics_context_save_gstate_mac.mm", + ] ++ configs += ["//electron/build/config:mas_build"] + } + if (is_win) { + sources += [ +diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm +index b28640bb4d89ba9508d4086c9e5ca9ed4a9a7023..15cb883b91f624c1f23f4458dbf8d14763d11778 100644 +--- a/ui/gfx/platform_font_mac.mm ++++ b/ui/gfx/platform_font_mac.mm +@@ -28,9 +28,11 @@ + + using Weight = Font::Weight; + ++#if !IS_MAS_BUILD() + extern "C" { + bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef); + } ++#endif + + namespace { + +@@ -245,7 +247,13 @@ CTFontRef SystemFontForConstructorOfType(PlatformFontMac::SystemFontType type) { + // TODO(avi, etienneb): Figure out this font stuff. + base::apple::ScopedCFTypeRef 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 e1bc7d4e424a2bcfa51394edf8b22a8711d9ec95..d2e2370658a86c99581d9f4d009af552f71eac94 100644 +--- a/ui/views/BUILD.gn ++++ b/ui/views/BUILD.gn +@@ -697,6 +697,7 @@ component("views") { + "IOSurface.framework", + "QuartzCore.framework", + ] ++ configs += ["//electron/build/config:mas_build"] + } + + if (is_win) { +@@ -1126,6 +1127,8 @@ source_set("test_support") { + "//testing/gtest", + ] + ++ configs += ["//electron/build/config:mas_build"] ++ + 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 f37c02488e6ba943ebf9b880a04bcfef9afc9d97..b10ed25b5cdf5eb2f314ed72226f71c8bc35e58e 100644 +--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h ++++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h +@@ -30,7 +30,9 @@ + #include "ui/views/window/dialog_observer.h" + + @class NativeWidgetMacNSWindow; ++#if !IS_MAS_BUILD() + @class NSAccessibilityRemoteUIElement; ++#endif + @class NSView; + + namespace remote_cocoa { +@@ -465,10 +467,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost + mojo::AssociatedRemote + 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 b3fa0a3684892edc14053ba8e7a5f2d5fb15e6e3..c45fd31fb1ac4cd256addabdd0a11ff75eaa3a99 100644 +--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm ++++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm +@@ -345,7 +345,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, + NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const { + if (in_process_ns_window_bridge_) + return in_process_ns_window_bridge_->ns_view(); ++#if !IS_MAS_BUILD() + return remote_view_accessible_; ++#else ++ return nullptr; ++#endif + } + + gfx::NativeViewAccessible +@@ -360,7 +364,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, + return [in_process_ns_window_bridge_->ns_view() window]; + } + ++#if !IS_MAS_BUILD() + return remote_window_accessible_; ++#else ++ return nullptr; ++#endif + } + + remote_cocoa::mojom::NativeWidgetNSWindow* +@@ -1407,6 +1415,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, + void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( + const std::vector& window_token, + const std::vector& view_token) { ++#if !IS_MAS_BUILD() + remote_window_accessible_ = + ui::RemoteAccessibility::GetRemoteElementFromToken(window_token); + remote_view_accessible_ = +@@ -1418,11 +1427,13 @@ void HandleAccelerator(const ui::Accelerator& accelerator, + ![NSAccessibilityRemoteUIElement isRemoteUIApp]) { + [NSAccessibilityRemoteUIElement setRemoteUIApp:YES]; + } ++#endif + } + + bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken( + int64_t* pid, + std::vector* token) { ++#if !IS_MAS_BUILD() + *pid = getpid(); + id element_id = GetNativeViewAccessible(); + +@@ -1435,6 +1446,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 e3dd4fab3a1cac0138f8dac60247e0ea3343e87e..f31130eaa3719eda0da5b3f0e8c294775faf6bd4 100644 +--- a/ui/views/controls/webview/BUILD.gn ++++ b/ui/views/controls/webview/BUILD.gn +@@ -19,6 +19,9 @@ component("webview") { + + if (is_mac) { + sources += [ "unhandled_keyboard_event_handler_mac.mm" ] ++ configs += [ ++ "//electron/build/config:mas_build", ++ ] + } + + if (is_win) { diff --git a/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch b/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch deleted file mode 100644 index eeffbd2d2f00..000000000000 --- a/patches/chromium/mas_avoid_usage_of_private_macos_apis.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Mon, 4 Mar 2019 14:43:36 -0800 -Subject: mas: avoid usage of private macOS APIs - -Disable usage of the following private APIs in MAS builds: -* abort_report_np -* pthread_fchdir_np -* pthread_chdir_np -* SetApplicationIsDaemon -* _LSSetApplicationLaunchServicesServerConnectionStatus -* AreDeviceAndUserJoinedToDomain -* _CFIsObjC -* AudioDeviceDuck - -diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm -index 2bad2ed2f5205b3a2599aa3a620812aa32d52f87..ab3d4c953556d4f94075671436565a6c442f30d5 100644 ---- a/base/enterprise_util_mac.mm -+++ b/base/enterprise_util_mac.mm -@@ -115,6 +115,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) { -@@ -218,5 +226,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() { - - return state; - } -+#endif - - } // namespace base -diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc -index b267bc2272fa82334a70d897a900f1ea37b1a598..967e22699bf565368704972c021f9b425a570f08 100644 ---- a/base/process/launch_mac.cc -+++ b/base/process/launch_mac.cc -@@ -21,13 +21,18 @@ - #include "base/threading/scoped_blocking_call.h" - #include "base/threading/thread_restrictions.h" - #include "base/trace_event/base_tracing.h" -+#if IS_MAS_BUILD() -+#include -+#endif - - 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); -@@ -99,13 +104,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 - -@@ -226,7 +245,7 @@ Process LaunchProcess(const std::vector& argv, - file_actions.Inherit(STDERR_FILENO); - } - --#if BUILDFLAG(IS_MAC) -+#if 0 - if (options.disclaim_responsibility) { - DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1)); - } -diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc -index 34935789d56a6f65926599f053a7bc1b2020ad12..67270c5c75492e9d4c91d33a1eca5caf1cc43ace 100644 ---- a/media/audio/mac/audio_low_latency_input_mac.cc -+++ b/media/audio/mac/audio_low_latency_input_mac.cc -@@ -30,19 +30,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 -diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc -index 095c639b9893e885d8937e29ed7d47a7c28bc6b6..cfa5e307de8326fbc335996feaf9595d1572cd3d 100644 ---- a/sandbox/mac/sandbox_logging.cc -+++ b/sandbox/mac/sandbox_logging.cc -@@ -33,9 +33,11 @@ - } - #endif - -+#if !IS_MAS_BUILD() - extern "C" { - void abort_report_np(const char*, ...); - } -+#endif - - namespace sandbox::logging { - -@@ -76,9 +78,11 @@ void SendOsLog(Level level, const char* message) { - sandbox::crash_message::SetCrashMessage(message); - } - -+#if !IS_MAS_BUILD() - if (level == Level::FATAL) { - abort_report_np(message); - } -+#endif - } - - // |error| is strerror(errno) when a P* logging function is called. Pass -diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc -index eb81a70e4d5d5cd3e6ae9b45f8cd1c795ea76c51..dc30306f2c5d20503399fc3a8860773aa0044352 100644 ---- a/sandbox/mac/system_services.cc -+++ b/sandbox/mac/system_services.cc -@@ -9,6 +9,7 @@ - - #include "base/apple/osstatus_logging.h" - -+#if !IS_MAS_BUILD() - extern "C" { - OSStatus SetApplicationIsDaemon(Boolean isDaemon); - void _LSSetApplicationLaunchServicesServerConnectionStatus( -@@ -19,10 +20,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 +39,13 @@ void DisableLaunchServices() { - 0, ^bool(CFDictionaryRef options) { - return false; - }); -+ #endif - } - - void DisableCoreServicesCheckFix() { -+#if !IS_MAS_BUILD() - _CSCheckFixDisable(); -+#endif - } - - } // namespace sandbox diff --git a/patches/chromium/mas_blink_no_private_api.patch b/patches/chromium/mas_blink_no_private_api.patch deleted file mode 100644 index e276a4f292ef..000000000000 --- a/patches/chromium/mas_blink_no_private_api.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Thu, 20 Sep 2018 17:48:49 -0700 -Subject: mas: avoid private APIs in blink - -Guard usages in chromium code of private Mac APIs by MAS_BUILD, so they can -be excluded for people who want to submit their apps to the Mac App store. - -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..78e4e0fe20e0fdfeab18b28fe208d5aa38eb0bd1 100644 ---- a/third_party/blink/renderer/core/editing/kill_ring_mac.mm -+++ b/third_party/blink/renderer/core/editing/kill_ring_mac.mm -@@ -27,6 +27,7 @@ - - namespace blink { - -+#if !IS_MAS_BUILD() - extern "C" { - - // Kill ring calls. Would be better to use NSKillRing.h, but that's not -@@ -39,38 +40,53 @@ - void _NSNewKillRingSequence(); - void _NSSetKillRingToYankedState(); - } -+#endif - - static void InitializeKillRingIfNeeded() { - static bool initialized_kill_ring = false; - if (!initialized_kill_ring) { - initialized_kill_ring = true; -+#if !IS_MAS_BUILD() - _NSInitializeKillRing(); -+#endif - } - } - - void KillRing::Append(const String& string) { - InitializeKillRingIfNeeded(); -+#if !IS_MAS_BUILD() - _NSAppendToKillRing(string); -+#endif - } - - void KillRing::Prepend(const String& string) { - InitializeKillRingIfNeeded(); -+#if !IS_MAS_BUILD() - _NSPrependToKillRing(string); -+#endif - } - - String KillRing::Yank() { - InitializeKillRingIfNeeded(); -+#if !IS_MAS_BUILD() - return _NSYankFromKillRing(); -+#else -+ return ""; -+#endif - } - - void KillRing::StartNewSequence() { - InitializeKillRingIfNeeded(); -+#if !IS_MAS_BUILD() - _NSNewKillRingSequence(); -+#endif - } - - void KillRing::SetToYankedState() { - InitializeKillRingIfNeeded(); -+#if !IS_MAS_BUILD() - _NSSetKillRingToYankedState(); -+#endif - } - - } // namespace blink diff --git a/patches/chromium/mas_disable_custom_window_frame.patch b/patches/chromium/mas_disable_custom_window_frame.patch deleted file mode 100644 index d749dc26d247..000000000000 --- a/patches/chromium/mas_disable_custom_window_frame.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Thu, 20 Sep 2018 17:48:49 -0700 -Subject: mas: disable private window-frame APIs - -Disable private window frame APIs (NSNextStepFrame and NSThemeFrame) for MAS -build. - -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 b8eb13a42aa41143412b9a01f2716a3608b968fb..8eaccd4ce7e484aef1b4517935bc4ba2fa4a1ea4 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,6 +9,7 @@ - #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h" - #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h" - -+#if !IS_MAS_BUILD() - @interface NSWindow (PrivateBrowserNativeWidgetAPI) - + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; - @end -@@ -65,10 +66,13 @@ - (BOOL)_shouldCenterTrafficLights { - - @end - -+#endif // MAS_BUILD -+ - @implementation BrowserNativeWidgetWindow - - // 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]) -@@ -115,6 +119,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. -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..dbbebbdc1735bc14224dfcde0b7fe3a6fd9f9e40 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,8 @@ - - #import "components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.h" - -+#if !IS_MAS_BUILD() -+ - @interface NSWindow (PrivateAPI) - + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle; - @end -@@ -18,8 +20,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 +33,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 085d9821933390c781fe11d441910501bf22d601..6c79434e2a5b59267c9801ac23c318c9c320f019 100644 ---- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h -+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.h -@@ -17,6 +17,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 -@@ -33,6 +34,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 6e837d66209e6322324227bc596e40e56fccc495..3c3c5db57cfaba8e59867e74b81b4fad1cf7a8ed 100644 ---- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm -+++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm -@@ -101,7 +101,9 @@ void OrderChildWindow(NSWindow* child_window, - } // namespace - - @interface NSWindow (Private) -+#if !IS_MAS_BUILD() - + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle; -+#endif - - (BOOL)hasKeyAppearance; - - (long long)_resizeDirectionForMouseLocation:(CGPoint)location; - - (BOOL)_isConsideredOpenForPersistentState; -@@ -139,6 +141,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event { - } - @end - -+#if !IS_MAS_BUILD() -+ - @implementation NativeWidgetMacNSWindowTitledFrame - - (void)mouseDown:(NSEvent*)event { - if (self.window.isMovable) -@@ -165,6 +169,8 @@ - (BOOL)usesCustomDrawing { - } - @end - -+#endif // MAS_BUILD -+ - @implementation NativeWidgetMacNSWindow { - @private - CommandDispatcher* __strong _commandDispatcher; -@@ -353,6 +359,8 @@ - (NSAccessibilityRole)accessibilityRole { - - // NSWindow overrides. - -+#if !IS_MAS_BUILD() -+ - + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { - if (windowStyle & NSWindowStyleMaskTitled) { - if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class]) -@@ -364,6 +372,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle { - return [super frameViewClassForStyleMask:windowStyle]; - } - -+#endif -+ - - (BOOL)_isTitleHidden { - bool shouldShowWindowTitle = YES; - if (_bridge) diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch deleted file mode 100644 index d952d840d81c..000000000000 --- a/patches/chromium/mas_disable_remote_accessibility.patch +++ /dev/null @@ -1,324 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Thu, 20 Sep 2018 17:48:49 -0700 -Subject: mas: avoid usage of NSAccessibilityRemoteUIElement - -According to ccameron: - -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. - -diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm -index 5a096477c123a782341115f964c4975301ccaf9a..ecfbb3b405425af346a6ba6788fc1d8ff89760cd 100644 ---- a/components/remote_cocoa/app_shim/application_bridge.mm -+++ b/components/remote_cocoa/app_shim/application_bridge.mm -@@ -51,6 +51,7 @@ - - // NativeWidgetNSWindowHostHelper: - id GetNativeViewAccessible() override { -+#if !IS_MAS_BUILD() - if (!remote_accessibility_element_) { - int64_t browser_pid = 0; - std::vector element_token; -@@ -61,6 +62,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; -@@ -99,7 +103,9 @@ void GetWordAt(const gfx::Point& location_in_content, - mojo::AssociatedRemote text_input_host_remote_; - - std::unique_ptr bridge_; -+#if !IS_MAS_BUILD() - NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_; -+#endif - }; - - } // namespace -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 053b8a2182778b469941116eab3acd5fd6fd8099..d085258d5970b37215fe0d5591e6c0306401a172 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 -@@ -600,10 +600,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 -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 76be676717e62c429319338c6115be89f2dfa424..18a5fd3c87b08c95d668b70c9b8f7a76413a75bb 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 -@@ -86,8 +86,10 @@ id GetFocusedBrowserAccessibilityElement() override { - return nil; - } - void SetAccessibilityWindow(NSWindow* window) override { -+#if !IS_MAS_BUILD() - host_->SetRemoteAccessibilityWindowToken( - ui::RemoteAccessibility::GetTokenForLocalElement(window)); -+#endif - } - - void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event, -diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm -index 5a6706495ed2a8f1cd781da9bde8572318bf6897..afd4d1f728a7f056e49b2ecb006c5a05388d3409 100644 ---- a/content/browser/accessibility/browser_accessibility_manager_mac.mm -+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm -@@ -21,7 +21,9 @@ - #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" - #include "ui/accessibility/ax_role_properties.h" - #include "ui/accessibility/platform/ax_private_webkit_constants_mac.h" -+#if !IS_MAS_BUILD() - #include "ui/base/cocoa/remote_accessibility_api.h" -+#endif - - namespace { - -@@ -224,6 +226,7 @@ void PostAnnouncementNotification(NSString* announcement, - return; - } - -+#if !IS_MAS_BUILD() - BrowserAccessibilityManager* root_manager = GetManagerForRootFrame(); - if (root_manager) { - BrowserAccessibilityManagerMac* root_manager_mac = -@@ -246,6 +249,7 @@ void PostAnnouncementNotification(NSString* announcement, - return; - } - } -+#endif - - // Use native VoiceOver support for live regions. - BrowserAccessibilityCocoa* retained_node = native_node; -@@ -632,6 +636,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 -@@ -660,6 +665,7 @@ void PostAnnouncementNotification(NSString* announcement, - if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) { - return true; - } -+#endif - - return false; - } -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 90d8ab3119b469e62ca771aaeb3d6b5c13d79775..825d46c85a44adb68adefe4adc0dd926e71c9129 100644 ---- a/content/browser/renderer_host/render_widget_host_view_mac.h -+++ b/content/browser/renderer_host/render_widget_host_view_mac.h -@@ -50,7 +50,9 @@ class ScopedPasswordInputEnabler; - - @protocol RenderWidgetHostViewMacDelegate; - -+#if !IS_MAS_BUILD() - @class NSAccessibilityRemoteUIElement; -+#endif - @class RenderWidgetHostViewCocoa; - @class CursorAccessibilityScaleFactorObserver; - -@@ -676,9 +678,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 c260544133059b2104c1185b4708494ff1bde286..0d752ae48eb5f822dd80c369b726a7d411d71c78 100644 ---- a/content/browser/renderer_host/render_widget_host_view_mac.mm -+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -272,8 +272,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. -@@ -1639,8 +1641,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, - - gfx::NativeViewAccessible - RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { -+#if !IS_MAS_BUILD() - if (remote_window_accessible_) - return remote_window_accessible_; -+#endif - return [GetInProcessNSView() window]; - } - -@@ -1685,9 +1689,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( -@@ -2194,12 +2200,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, - - void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken( - const std::vector& 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/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 3af6a66b319a17f7a5962a3135358dfa3ca5fa00..39a960146504ac6034fe24593006d09ff9c667ac 100644 ---- a/ui/base/BUILD.gn -+++ b/ui/base/BUILD.gn -@@ -376,6 +376,13 @@ component("base") { - sources += [ "resource/resource_bundle_lacros.cc" ] - } - -+ if (is_mas_build) { -+ sources -= [ -+ "cocoa/remote_accessibility_api.h", -+ "cocoa/remote_accessibility_api.mm", -+ ] -+ } -+ - if (is_ios) { - sources += [ - "device_form_factor_ios.mm", -diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h -index 3182458838aa96d34911280ab4c6c3aa4aa22d6d..17b57f54492421743a0d69106eefce2c9beb8e87 100644 ---- a/ui/base/cocoa/remote_accessibility_api.h -+++ b/ui/base/cocoa/remote_accessibility_api.h -@@ -13,6 +13,8 @@ - - // NSAccessibilityRemoteUIElement is a private class in AppKit. - -+#if !IS_MAS_BUILD() -+ - @interface NSAccessibilityRemoteUIElement : NSObject - + (void)setRemoteUIApp:(BOOL)flag; - + (BOOL)isRemoteUIApp; -@@ -38,4 +40,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAccessibility { - - } // namespace ui - -+#endif // MAS_BUILD -+ - #endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_ -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 f37c02488e6ba943ebf9b880a04bcfef9afc9d97..b10ed25b5cdf5eb2f314ed72226f71c8bc35e58e 100644 ---- a/ui/views/cocoa/native_widget_mac_ns_window_host.h -+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h -@@ -30,7 +30,9 @@ - #include "ui/views/window/dialog_observer.h" - - @class NativeWidgetMacNSWindow; -+#if !IS_MAS_BUILD() - @class NSAccessibilityRemoteUIElement; -+#endif - @class NSView; - - namespace remote_cocoa { -@@ -465,10 +467,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost - mojo::AssociatedRemote - 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 b3fa0a3684892edc14053ba8e7a5f2d5fb15e6e3..c45fd31fb1ac4cd256addabdd0a11ff75eaa3a99 100644 ---- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm -+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -@@ -345,7 +345,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, - NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const { - if (in_process_ns_window_bridge_) - return in_process_ns_window_bridge_->ns_view(); -+#if !IS_MAS_BUILD() - return remote_view_accessible_; -+#else -+ return nullptr; -+#endif - } - - gfx::NativeViewAccessible -@@ -360,7 +364,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator, - return [in_process_ns_window_bridge_->ns_view() window]; - } - -+#if !IS_MAS_BUILD() - return remote_window_accessible_; -+#else -+ return nullptr; -+#endif - } - - remote_cocoa::mojom::NativeWidgetNSWindow* -@@ -1407,6 +1415,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, - void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( - const std::vector& window_token, - const std::vector& view_token) { -+#if !IS_MAS_BUILD() - remote_window_accessible_ = - ui::RemoteAccessibility::GetRemoteElementFromToken(window_token); - remote_view_accessible_ = -@@ -1418,11 +1427,13 @@ void HandleAccelerator(const ui::Accelerator& accelerator, - ![NSAccessibilityRemoteUIElement isRemoteUIApp]) { - [NSAccessibilityRemoteUIElement setRemoteUIApp:YES]; - } -+#endif - } - - bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken( - int64_t* pid, - std::vector* token) { -+#if !IS_MAS_BUILD() - *pid = getpid(); - id element_id = GetNativeViewAccessible(); - -@@ -1435,6 +1446,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, - } - - *token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id); -+#endif - return true; - } - diff --git a/patches/chromium/mas_disable_remote_layer.patch b/patches/chromium/mas_disable_remote_layer.patch deleted file mode 100644 index 6f7cfd828c5e..000000000000 --- a/patches/chromium/mas_disable_remote_layer.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Thu, 20 Sep 2018 17:48:49 -0700 -Subject: mas: disable remote layer APIs (CAContext and CALayerHost) for MAS - build - -Accordin to ccameron: - -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). - -diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.h b/gpu/ipc/service/image_transport_surface_overlay_mac.h -index d1deb3d7d7d587b36bc8c19cf3f331a0ec6764dd..263c5f3446dab67b9f8d3be4d08eadbaa749dc1d 100644 ---- a/gpu/ipc/service/image_transport_surface_overlay_mac.h -+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.h -@@ -23,7 +23,9 @@ - #include "ui/display/types/display_constants.h" - #endif - -+#if !IS_MAS_BUILD() - @class CAContext; -+#endif - @class CALayer; - - namespace ui { -@@ -76,8 +78,10 @@ class ImageTransportSurfaceOverlayMacEGL : public gl::Presenter { - const gfx::PresentationFeedback& feedback); - void PopulateCALayerParameters(); - -+#if !IS_MAS_BUILD() - const bool use_remote_layer_api_; - CAContext* __strong ca_context_; -+#endif - std::unique_ptr ca_layer_tree_coordinator_; - - gfx::Size pixel_size_; -diff --git a/gpu/ipc/service/image_transport_surface_overlay_mac.mm b/gpu/ipc/service/image_transport_surface_overlay_mac.mm -index caa7b447f79d837f100b3ee8bb4063145811b9bc..5c510fafb2891759cc12711286e3c34f994411bd 100644 ---- a/gpu/ipc/service/image_transport_surface_overlay_mac.mm -+++ b/gpu/ipc/service/image_transport_surface_overlay_mac.mm -@@ -52,12 +52,16 @@ - } // namespace - - ImageTransportSurfaceOverlayMacEGL::ImageTransportSurfaceOverlayMacEGL() -- : use_remote_layer_api_(ui::RemoteLayerAPISupported()), -+ : -+#if !IS_MAS_BUILD() -+ use_remote_layer_api_(ui::RemoteLayerAPISupported()), -+#endif - scale_factor_(1), - weak_ptr_factory_(this) { - static bool av_disabled_at_command_line = - !base::FeatureList::IsEnabled(kAVFoundationOverlays); - -+#if !IS_MAS_BUILD() - ca_layer_tree_coordinator_ = std::make_unique( - use_remote_layer_api_, !av_disabled_at_command_line); - -@@ -78,6 +82,10 @@ - #endif - ca_context_.layer = ca_layer_tree_coordinator_->GetCALayerForDisplay(); - } -+#else -+ ca_layer_tree_coordinator_ = std::make_unique( -+ /*allow_remote_layers=*/false, !av_disabled_at_command_line); -+#endif - } - - ImageTransportSurfaceOverlayMacEGL::~ImageTransportSurfaceOverlayMacEGL() { -@@ -195,9 +203,13 @@ - TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD, - "GLImpl", static_cast(gl::GetGLImplementation()), - "width", pixel_size_.width()); -+#if !IS_MAS_BUILD() - if (use_remote_layer_api_) { - params.ca_context_id = [ca_context_ contextId]; - } else { -+#else -+ if (true) { -+#endif - IOSurfaceRef io_surface = - ca_layer_tree_coordinator_->GetIOSurfaceForDisplay(); - if (io_surface) { -diff --git a/ui/accelerated_widget_mac/display_ca_layer_tree.mm b/ui/accelerated_widget_mac/display_ca_layer_tree.mm -index dcf493d62990018040a3f84b6f875af737bd2214..6ffffe8b3946e0427aead8be19878c537c841294 100644 ---- a/ui/accelerated_widget_mac/display_ca_layer_tree.mm -+++ b/ui/accelerated_widget_mac/display_ca_layer_tree.mm -@@ -121,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; -@@ -150,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/base/cocoa/remote_layer_api.h b/ui/base/cocoa/remote_layer_api.h -index 59dc2f82214cfd883b6ebef3b0fb25af6387a9cd..d585ba14b34021a93c878d0d9f9d9ef70eed32ca 100644 ---- a/ui/base/cocoa/remote_layer_api.h -+++ b/ui/base/cocoa/remote_layer_api.h -@@ -17,6 +17,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 +69,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 fc25ba79d2b0e1acdb7ba54b89e7d6e16f94771b..962df2d65d61ec0836cf465d847eb666033846f2 100644 ---- a/ui/base/cocoa/remote_layer_api.mm -+++ b/ui/base/cocoa/remote_layer_api.mm -@@ -10,6 +10,7 @@ - - namespace ui { - -+#if !IS_MAS_BUILD() - namespace { - // Control use of cross-process CALayers to display content directly from the - // GPU process on Mac. -@@ -17,8 +18,10 @@ - "RemoteCoreAnimationAPI", - base::FEATURE_ENABLED_BY_DEFAULT); - } // namespace -+#endif - - bool RemoteLayerAPISupported() { -+#if !IS_MAS_BUILD() - if (!base::FeatureList::IsEnabled(kRemoteCoreAnimationAPI)) - return false; - -@@ -55,6 +58,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/patches/chromium/mas_no_private_api.patch b/patches/chromium/mas_no_private_api.patch deleted file mode 100644 index 64c5e51252e3..000000000000 --- a/patches/chromium/mas_no_private_api.patch +++ /dev/null @@ -1,447 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Tue, 9 Oct 2018 10:36:20 -0700 -Subject: mas: avoid some private APIs - -Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be -excluded for people who want to submit their apps to the Mac App store. - -diff --git a/base/process/process_info_mac.cc b/base/process/process_info_mac.cc -index 94a028be3c315edc0056408ab9ab41b6b001a1c1..0d830234edb5621f57e39f4a951d357a23f677c1 100644 ---- a/base/process/process_info_mac.cc -+++ b/base/process/process_info_mac.cc -@@ -8,15 +8,21 @@ - #include - #include - -+#if !IS_MAS_BUILD() - extern "C" { - pid_t responsibility_get_pid_responsible_for_pid(pid_t); - } -+#endif - - namespace base { - - bool IsProcessSelfResponsible() { -+#if !IS_MAS_BUILD() - const pid_t pid = getpid(); - return responsibility_get_pid_responsible_for_pid(pid) == pid; -+#else -+ return true; -+#endif - } - - } // namespace base -diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm -index d4db3b179725cb96bcbd0f73db7d52ef8b7522db..6afbf1defb0591d9fe59a81e6c74746d3e15f081 100644 ---- a/content/renderer/renderer_main_platform_delegate_mac.mm -+++ b/content/renderer/renderer_main_platform_delegate_mac.mm -@@ -10,9 +10,11 @@ - #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 +24,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 +33,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 a119b4439bfb9218c7aaf09dca8e78527da7f20d..faa813b003940280c6eeb87e70173019bdd5280c 100644 ---- a/content/renderer/theme_helper_mac.mm -+++ b/content/renderer/theme_helper_mac.mm -@@ -8,10 +8,11 @@ - - #include "base/strings/sys_string_conversions.h" - -+#if !IS_MAS_BUILD() - extern "C" { - bool CGFontRenderingGetFontSmoothingDisabled(void); - } -- -+#endif - namespace content { - - void SystemColorsDidChange(int aqua_color_variant) { -@@ -24,8 +25,18 @@ void SystemColorsDidChange(int aqua_color_variant) { - } - - 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/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm -index 37ce08d9c11de4e53dbf9a9db2e74f1b12adafcf..bb9433fcb49d40adbe9ef8fdddfde49fc2809a78 100644 ---- a/device/bluetooth/bluetooth_adapter_mac.mm -+++ b/device/bluetooth/bluetooth_adapter_mac.mm -@@ -37,6 +37,7 @@ - #include "device/bluetooth/bluetooth_socket_mac.h" - #include "device/bluetooth/public/cpp/bluetooth_address.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 -@@ -50,6 +51,7 @@ - // [4] https://support.apple.com/kb/PH25091 - void IOBluetoothPreferenceSetControllerPowerState(int state); - } -+#endif - - namespace { - -@@ -93,8 +95,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 - classic_discovery_manager_( - BluetoothDiscoveryManagerMac::CreateClassic(this)), - device_paired_status_callback_( -@@ -244,8 +248,12 @@ bool IsDeviceSystemPaired(const std::string& device_address) { - } - - bool BluetoothAdapterMac::SetPoweredImpl(bool powered) { -+#if !IS_MAS_BUILD() - power_state_function_.Run(base::strict_cast(powered)); - return true; -+#else -+ return false; -+#endif - } - - base::WeakPtr -diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc -index b3e06372457f57a8c835a790691d8f492baecdec..b27691313cb15d663c903d05cdef20e44270c690 100644 ---- a/media/audio/mac/audio_manager_mac.cc -+++ b/media/audio/mac/audio_manager_mac.cc -@@ -991,7 +991,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( - - void AudioManagerMac::InitializeOnAudioThread() { - DCHECK(GetTaskRunner()->BelongsToCurrentThread()); -- InitializeCoreAudioDispatchOverride(); -+ // InitializeCoreAudioDispatchOverride(); - power_observer_ = std::make_unique(); - } - -diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc -index a93e7cd74d2a9d692304ecf10279fae8e96bb695..3506d6ca555701bad6623cc1c614e0081892e42b 100644 ---- a/net/dns/dns_config_service_posix.cc -+++ b/net/dns/dns_config_service_posix.cc -@@ -130,8 +130,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."; -@@ -148,6 +148,7 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher { - success = false; - } - #endif // !BUILDFLAG(IS_IOS) -+#endif - return success; - } - -diff --git a/sandbox/mac/sandbox_compiler.cc b/sandbox/mac/sandbox_compiler.cc -index f35d9ef2a2df3db8ecbf1d7b909c7b1cf33f3cd9..a710b8b4f851666fd65bb37f69ec2fa70259697b 100644 ---- a/sandbox/mac/sandbox_compiler.cc -+++ b/sandbox/mac/sandbox_compiler.cc -@@ -47,6 +47,7 @@ bool SandboxCompiler::SetParameter(const std::string& key, - } - - bool SandboxCompiler::CompileAndApplyProfile(std::string& error) { -+#if !IS_MAS_BUILD() - if (mode_ == Target::kSource) { - std::vector params; - -@@ -67,6 +68,9 @@ bool SandboxCompiler::CompileAndApplyProfile(std::string& error) { - } - } - return false; -+#else -+ return true; -+#endif - } - - bool SandboxCompiler::CompilePolicyToProto(mac::SandboxPolicy& policy, -diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc -index 15c835e118456394c0a00ac98c11241c14ca75bd..83759e5fbc252fa57ca2fa122873dfac3d61d46d 100644 ---- a/sandbox/mac/seatbelt.cc -+++ b/sandbox/mac/seatbelt.cc -@@ -9,7 +9,7 @@ - - extern "C" { - #include -- -+#if !IS_MAS_BUILD() - int sandbox_init_with_parameters(const char* profile, - uint64_t flags, - const char* const parameters[], -@@ -40,13 +40,13 @@ 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() - bool HandleSandboxResult(int rv, char* errorbuf, std::string* error) { - if (rv == 0) { - if (error) -@@ -74,36 +74,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. -@@ -114,6 +126,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 -@@ -122,6 +135,9 @@ bool Seatbelt::Init(const char* profile, uint64_t flags, std::string* error) { - int rv = ::sandbox_init(profile, flags, &errorbuf); - return HandleSandboxResult(rv, errorbuf, error); - #pragma clang diagnostic pop -+#else -+ return true; -+#endif - } - - // static -@@ -129,10 +145,14 @@ bool Seatbelt::InitWithParams(const char* profile, - uint64_t flags, - const char* const parameters[], - std::string* error) { -+#if !IS_MAS_BUILD() - char* errorbuf = nullptr; - int rv = - ::sandbox_init_with_parameters(profile, flags, parameters, &errorbuf); - return HandleSandboxResult(rv, errorbuf, error); -+#else -+ return true; -+#endif - } - - // static -@@ -140,6 +160,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); -@@ -149,33 +170,44 @@ bool Seatbelt::Compile(const char* profile, - compiled_profile.assign(reinterpret_cast(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(profile.data()), - .size = profile.size()}; - return HandleSandboxErrno(::sandbox_apply(&sbox_profile), - "sandbox_apply: ", error); -+#else -+ return true; -+#endif - } - - // static - void Seatbelt::FreeError(char* errorbuf) { -+#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 - #pragma clang diagnostic ignored "-Wdeprecated-declarations" - return ::sandbox_free_error(errorbuf); - #pragma clang diagnostic pop -+#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 18479382a277cb2b25626ec8d31442bfd1377ee6..7d80d7fa8337523c3a70f317f883f0cc26c6f40b 100644 ---- a/sandbox/mac/seatbelt_extension.cc -+++ b/sandbox/mac/seatbelt_extension.cc -@@ -11,6 +11,7 @@ - #include "base/notreached.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 +23,7 @@ char* sandbox_extension_issue_file(const char* type, - const char* path, - uint32_t flags); - } -+#endif - - namespace sandbox { - -@@ -50,7 +52,11 @@ std::unique_ptr 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 +68,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 +90,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(); - return nullptr; -diff --git a/ui/accessibility/platform/inspect/ax_transform_mac.mm b/ui/accessibility/platform/inspect/ax_transform_mac.mm -index c737a2ca1afb44083aef33c6aa4518bea68d1aba..879f1357b5129849c5a1aa1731cf769712569e9e 100644 ---- a/ui/accessibility/platform/inspect/ax_transform_mac.mm -+++ b/ui/accessibility/platform/inspect/ax_transform_mac.mm -@@ -108,6 +108,7 @@ - } - } - -+#if !IS_MAS_BUILD() - // AXTextMarker - if (IsAXTextMarker(value)) { - return AXTextMarkerToBaseValue(value, indexer); -@@ -117,6 +118,7 @@ - if (IsAXTextMarkerRange(value)) { - return AXTextMarkerRangeToBaseValue(value, indexer); - } -+#endif - - // Accessible object - if (AXElementWrapper::IsValidElement(value)) { diff --git a/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch b/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch deleted file mode 100644 index afd855886132..000000000000 --- a/patches/chromium/mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Tue, 17 Nov 2020 16:59:28 -0800 -Subject: mas: use public APIs to determine if a font is a system font - -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/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm -index b28640bb4d89ba9508d4086c9e5ca9ed4a9a7023..15cb883b91f624c1f23f4458dbf8d14763d11778 100644 ---- a/ui/gfx/platform_font_mac.mm -+++ b/ui/gfx/platform_font_mac.mm -@@ -28,9 +28,11 @@ - - using Weight = Font::Weight; - -+#if !IS_MAS_BUILD() - extern "C" { - bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef); - } -+#endif - - namespace { - -@@ -245,7 +247,13 @@ CTFontRef SystemFontForConstructorOfType(PlatformFontMac::SystemFontType type) { - // TODO(avi, etienneb): Figure out this font stuff. - base::apple::ScopedCFTypeRef 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/patches/chromium/printing.patch b/patches/chromium/printing.patch index 977d28faff9c..fc651f913d0e 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -904,10 +904,10 @@ index c68b68767ac52602981278ec655d9ccfad0c30ab..df2ea4524584417d859e1a22ec8a49c8 // Calculate number of pages in source document. uint32_t CalculateNumberOfPages(blink::WebLocalFrame* frame, diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn -index 34e00e884f05ed43d6966372479d268ac4b681ed..264aecf8928c820ac7624d798e834f8056bed405 100644 +index f88d207fc9c8d831334ef0c761099799ed3928d8..83afe4327beefdf494f6b822da2f62a1cfb78484 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn -@@ -2992,8 +2992,9 @@ source_set("browser") { +@@ -2993,8 +2993,9 @@ source_set("browser") { "//ppapi/shared_impl", ] diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index c9575bd143f7..a50ddf6987fd 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -7,10 +7,8 @@ This allows Electron to override `acceptsFirstMouse` on Mac so that windows can respond to the first mouse click in their window, which is desirable for some kinds of utility windows. Similarly for `disableAutoHideCursor`. -Additionally, disables usage of some private APIs in MAS builds. - 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 81f705328efd2de0957c1ef309e20c421e0959eb..d6f9998890d7a83a8fb221691aa2f1e761461d52 100644 +index 81f705328efd2de0957c1ef309e20c421e0959eb..47afd2553bf76b5b185a4be131196d90cf9cad44 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 @@ -158,6 +158,15 @@ void ExtractUnderlines(NSAttributedString* string, @@ -61,25 +59,3 @@ index 81f705328efd2de0957c1ef309e20c421e0959eb..d6f9998890d7a83a8fb221691aa2f1e7 // We only handle key down events and just simply forward other events. if (eventType != NSEventTypeKeyDown) { _hostHelper->ForwardKeyboardEvent(event, latency_info); -@@ -1999,15 +2019,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; - }