123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
- From: Cheng Zhao <[email protected]>
- 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 9db1a07aabdbc5ebcf5d971664a8783a3d4810a3..eed51d0af307a0bb1c6cbbcbe2dbd3c906d0999c 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
- @@ -10,6 +10,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
- @@ -70,10 +71,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])
- @@ -120,6 +124,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 94ac4fa8db42cb70fa5032a0c1eeb10ad94b8d9a..048cfe7b16d74845492c9317f1ed9790fed36250 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 517333705c9b68706159bff2396c3ba1f8dc1f55..f11ce18fb4d1567eb53e6b9272424eecb40e51e1 100644
- --- a/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
- +++ b/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
- @@ -113,7 +113,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;
- @@ -161,6 +163,8 @@ - (void)cr_mouseDownOnFrameView:(NSEvent*)event {
- }
- @end
-
- +#if !IS_MAS_BUILD()
- +
- @implementation NativeWidgetMacNSWindowTitledFrame
- - (void)mouseDown:(NSEvent*)event {
- if (self.window.isMovable)
- @@ -187,6 +191,8 @@ - (BOOL)usesCustomDrawing {
- }
- @end
-
- +#endif // MAS_BUILD
- +
- @implementation NativeWidgetMacNSWindow {
- @private
- CommandDispatcher* __strong _commandDispatcher;
- @@ -396,6 +402,8 @@ - (NSAccessibilityRole)accessibilityRole {
-
- // NSWindow overrides.
-
- +#if !IS_MAS_BUILD()
- +
- + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
- if (windowStyle & NSWindowStyleMaskTitled) {
- if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
- @@ -407,6 +415,8 @@ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
- return [super frameViewClassForStyleMask:windowStyle];
- }
-
- +#endif
- +
- - (BOOL)_isTitleHidden {
- bool shouldShowWindowTitle = YES;
- if (_bridge)
|