From 4639c68a7b7e54465c01ae6c0a009d76b8d87363 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 26 Jul 2019 14:11:37 +0200 Subject: [PATCH] chore: remove no longer needed macOS SDK forward declarations (#19446) --- filenames.gni | 1 - script/lint.js | 1 - shell/browser/mac/atom_application.h | 25 +- shell/browser/native_window_mac.mm | 17 -- shell/browser/ui/cocoa/atom_touch_bar.h | 1 - .../ui/cocoa/touch_bar_forward_declarations.h | 267 ------------------ 6 files changed, 1 insertion(+), 311 deletions(-) delete mode 100644 shell/browser/ui/cocoa/touch_bar_forward_declarations.h diff --git a/filenames.gni b/filenames.gni index 445363e5aae2..57895c177dd9 100644 --- a/filenames.gni +++ b/filenames.gni @@ -349,7 +349,6 @@ filenames = { "shell/browser/ui/cocoa/views_delegate_mac.mm", "shell/browser/ui/cocoa/root_view_mac.mm", "shell/browser/ui/cocoa/root_view_mac.h", - "shell/browser/ui/cocoa/touch_bar_forward_declarations.h", "shell/browser/ui/cocoa/atom_inspectable_web_contents_view.h", "shell/browser/ui/cocoa/atom_inspectable_web_contents_view.mm", "shell/browser/ui/cocoa/event_dispatching_window.h", diff --git a/script/lint.js b/script/lint.js index aa564d917b01..9cb6619f1896 100755 --- a/script/lint.js +++ b/script/lint.js @@ -22,7 +22,6 @@ const BLACKLIST = new Set([ ['shell', 'browser', 'ui', 'cocoa', 'atom_touch_bar.h'], ['shell', 'browser', 'ui', 'cocoa', 'atom_inspectable_web_contents_view.h'], ['shell', 'browser', 'ui', 'cocoa', 'event_dispatching_window.h'], - ['shell', 'browser', 'ui', 'cocoa', 'touch_bar_forward_declarations.h'], ['shell', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'], ['shell', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'], ['shell', 'common', 'node_includes.h'], diff --git a/shell/browser/mac/atom_application.h b/shell/browser/mac/atom_application.h index f8848470ecd4..46fc041d1601 100644 --- a/shell/browser/mac/atom_application.h +++ b/shell/browser/mac/atom_application.h @@ -10,29 +10,13 @@ #import // Forward Declare Appearance APIs -@interface NSApplication (HighSierraSDK) +@interface NSApplication (MojaveSDK) @property(copy, readonly) NSAppearance* effectiveAppearance API_AVAILABLE(macosx(10.14)); @property(copy, readonly) NSAppearance* appearance API_AVAILABLE(macosx(10.14)); - (void)setAppearance:(NSAppearance*)appearance API_AVAILABLE(macosx(10.14)); @end -#if !defined(MAC_OS_X_VERSION_10_13_2) - -// forward declare Touch ID APIs -typedef NS_ENUM(NSInteger, LABiometryType) { - LABiometryTypeNone = 0, - LABiometryTypeFaceID = 1, - LABiometryTypeTouchID = 2, -} API_AVAILABLE(macosx(10.13.2)); - -@interface LAContext (HighSierraPointTwoSDK) -@property(nonatomic, readonly) - LABiometryType biometryType API_AVAILABLE(macosx(10.13.2)); -@end - -#endif - // forward declare Access APIs typedef NSString* AVMediaType NS_EXTENSIBLE_STRING_ENUM; @@ -46,13 +30,6 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) { AVAuthorizationStatusAuthorizedMac = 3, }; -@interface NSMenuItem (HighSierraSDK) -@property(atomic, readwrite) - BOOL allowsKeyEquivalentWhenHidden API_AVAILABLE(macosx(10.13)); -- (void)setAllowsKeyEquivalentWhenHidden:(BOOL)arg1 - API_AVAILABLE(macosx(10.13)); -@end - @interface AVCaptureDevice (MojaveSDK) + (void)requestAccessForMediaType:(AVMediaType)mediaType completionHandler:(void (^)(BOOL granted))handler diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index d4eeb3020e72..e57e99328b86 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -152,23 +152,6 @@ @end -#if !defined(AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER) - -enum { NSWindowTabbingModeDisallowed = 2 }; - -@interface NSWindow (SierraSDK) -- (void)setTabbingMode:(NSInteger)mode; -- (void)setTabbingIdentifier:(NSString*)identifier; -- (void)addTabbedWindow:(NSWindow*)window ordered:(NSWindowOrderingMode)ordered; -- (IBAction)selectPreviousTab:(id)sender; -- (IBAction)selectNextTab:(id)sender; -- (IBAction)mergeAllWindows:(id)sender; -- (IBAction)moveTabToNewWindow:(id)sender; -- (IBAction)toggleTabBar:(id)sender; -@end - -#endif - @interface AtomProgressBar : NSProgressIndicator @end diff --git a/shell/browser/ui/cocoa/atom_touch_bar.h b/shell/browser/ui/cocoa/atom_touch_bar.h index 450ebe24de67..0de32f724433 100644 --- a/shell/browser/ui/cocoa/atom_touch_bar.h +++ b/shell/browser/ui/cocoa/atom_touch_bar.h @@ -15,7 +15,6 @@ #include "native_mate/constructor.h" #include "native_mate/persistent_dictionary.h" #include "shell/browser/native_window.h" -#include "shell/browser/ui/cocoa/touch_bar_forward_declarations.h" @interface AtomTouchBar : NSObject - -#if !defined(MAC_OS_X_VERSION_10_12_1) - -#pragma clang assume_nonnull begin - -@class NSTouchBar, NSTouchBarItem; -@class NSScrubber, NSScrubberItemView, NSScrubberArrangedView, - NSScrubberTextItemView, NSScrubberImageItemView, NSScrubberSelectionStyle; -@protocol NSTouchBarDelegate -, NSScrubberDelegate, NSScrubberDataSource, NSScrubberFlowLayoutDelegate, - NSScrubberFlowLayout; - -typedef float NSTouchBarItemPriority; -static const NSTouchBarItemPriority NSTouchBarItemPriorityHigh = 1000; -static const NSTouchBarItemPriority NSTouchBarItemPriorityNormal = 0; -static const NSTouchBarItemPriority NSTouchBarItemPriorityLow = -1000; - -enum NSScrubberMode { NSScrubberModeFixed = 0, NSScrubberModeFree }; - -typedef NSString* NSTouchBarItemIdentifier; -typedef NSString* NSTouchBarCustomizationIdentifier; - -static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceSmall = - @"NSTouchBarItemIdentifierFixedSpaceSmall"; - -static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceLarge = - @"NSTouchBarItemIdentifierFixedSpaceLarge"; - -static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFlexibleSpace = - @"NSTouchBarItemIdentifierFlexibleSpace"; - -static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierOtherItemsProxy = - @"NSTouchBarItemIdentifierOtherItemsProxy"; - -@interface NSTouchBar : NSObject - -- (instancetype)init NS_DESIGNATED_INITIALIZER; -- (nullable instancetype)initWithCoder:(NSCoder*)aDecoder - NS_DESIGNATED_INITIALIZER; - -@property(copy, nullable) - NSTouchBarCustomizationIdentifier customizationIdentifier; -@property(copy) NSArray* customizationAllowedItemIdentifiers; -@property(copy) NSArray* customizationRequiredItemIdentifiers; -@property(copy) NSArray* defaultItemIdentifiers; -@property(copy, readonly) NSArray* itemIdentifiers; -@property(copy, nullable) NSTouchBarItemIdentifier principalItemIdentifier; -@property(copy, nullable) - NSTouchBarItemIdentifier escapeKeyReplacementItemIdentifier; -@property(copy) NSSet* templateItems; -@property(nullable, weak) id delegate; - -- (nullable __kindof NSTouchBarItem*)itemForIdentifier: - (NSTouchBarItemIdentifier)identifier; - -@property(readonly, getter=isVisible) BOOL visible; - -@end - -@interface NSTouchBarItem : NSObject - -- (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)identifier - NS_DESIGNATED_INITIALIZER; -- (nullable instancetype)initWithCoder:(NSCoder*)coder - NS_DESIGNATED_INITIALIZER; -- (instancetype)init NS_UNAVAILABLE; - -@property(readonly, copy) NSTouchBarItemIdentifier identifier; -@property NSTouchBarItemPriority visibilityPriority; -@property(readonly, nullable) NSView* view; -@property(readonly, nullable) NSViewController* viewController; -@property(readwrite, copy) NSString* customizationLabel; -@property(readonly, getter=isVisible) BOOL visible; - -@end - -@interface NSGroupTouchBarItem : NSTouchBarItem - -+ (NSGroupTouchBarItem*)groupItemWithIdentifier: - (NSTouchBarItemIdentifier)identifier - items:(NSArray*)items; - -@property(strong) NSTouchBar* groupTouchBar; -@property(readwrite, copy, null_resettable) NSString* customizationLabel; - -@end - -@interface NSCustomTouchBarItem : NSTouchBarItem - -@property(readwrite, strong) __kindof NSView* view; -@property(readwrite, strong, nullable) - __kindof NSViewController* viewController; -@property(readwrite, copy, null_resettable) NSString* customizationLabel; - -@end - -@interface NSColorPickerTouchBarItem : NSTouchBarItem - -@property SEL action; -@property(weak) id target; -@property(copy) NSColor* color; -@property(strong) NSColorList* colorList; - -@end - -@interface NSPopoverTouchBarItem : NSTouchBarItem - -@property BOOL showsCloseButton; -@property(strong) NSImage* collapsedRepresentationImage; -@property(strong) NSString* collapsedRepresentationLabel; -@property(strong) NSTouchBar* popoverTouchBar; - -@end - -@interface NSSliderTouchBarItem : NSTouchBarItem - -@property SEL action; -@property(weak) id target; -@property(copy) NSString* label; -@property(strong) NSSlider* slider; - -@end - -@interface NSScrubber : NSView - -@property(weak) id delegate; -@property(weak) id dataSource; -@property NSScrubberMode mode; -@property BOOL showsArrowButtons; -@property(getter=isContinuous) BOOL continuous; -@property(strong, nullable) NSScrubberSelectionStyle* selectionBackgroundStyle; -@property(strong, nullable) NSScrubberSelectionStyle* selectionOverlayStyle; - -- (void)registerClass:(Class)itemViewClass - forItemIdentifier:(NSString*)itemIdentifier; - -- (__kindof NSScrubberItemView*)makeItemWithIdentifier:(NSString*)itemIdentifier - owner:(id)owner; -- (void)reloadData; - -@end - -@interface NSScrubberFlowLayout : NSObject -@end - -@interface NSScrubberSelectionStyle : NSObject - -@property(class, strong, readonly) - NSScrubberSelectionStyle* outlineOverlayStyle; -@property(class, strong, readonly) - NSScrubberSelectionStyle* roundedBackgroundStyle; - -@end - -@interface NSScrubberArrangedView : NSView - -@end - -@interface NSScrubberItemView : NSScrubberArrangedView - -@end - -@interface NSScrubberTextItemView : NSScrubberItemView - -@property(copy) NSString* title; - -@end - -@interface NSScrubberImageItemView : NSScrubberItemView - -@property(copy) NSImage* image; - -@end - -@interface NSWindow (TouchBarSDK) - -@property(strong, readwrite, nullable) NSTouchBar* touchBar; - -@end - -@interface NSButton (TouchBarSDK) - -@property(copy) NSColor* bezelColor; -+ (instancetype)buttonWithTitle:(NSString*)title - target:(id)target - action:(SEL)action; - -@end - -@interface NSTextField (TouchBarSDK) - -+ (instancetype)labelWithString:(NSString*)stringValue; - -@end - -@interface NSSegmentedControl (TouchBarSDK) - -+ (instancetype)segmentedControlWithLabels:(NSArray*)labels - trackingMode:(NSSegmentSwitchTracking)trackingMode - target:(id)target - action:(SEL)action; - -@end - -@protocol NSTouchBarDelegate - -@optional -- (nullable NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar - makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier; - -@end - -@protocol NSScrubberDelegate - -- (void)scrubber:(NSScrubber*)scrubber - didHighlightItemAtIndex:(NSInteger)highlightedIndex; -- (void)scrubber:(NSScrubber*)scrubber - didSelectItemAtIndex:(NSInteger)selectedIndex; - -@end - -@protocol NSScrubberDataSource - -- (NSInteger)numberOfItemsForScrubber:(NSScrubber*)scrubber; -- (__kindof NSScrubberItemView*)scrubber:(NSScrubber*)scrubber - viewForItemAtIndex:(NSInteger)index; - -@end - -@protocol NSScrubberFlowLayoutDelegate - -- (NSSize)scrubber:(NSScrubber*)scrubber - layout:(NSScrubberFlowLayout*)layout - sizeForItemAtIndex:(NSInteger)itemIndex; - -@end - -#pragma clang assume_nonnull end - -#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1 - -// When compiling against the 10.12.1 SDK or later, just provide forward -// declarations to suppress the partial availability warnings. - -@class NSCustomTouchBarItem; -@class NSGroupTouchBarItem; -@class NSTouchBar; -@protocol NSTouchBarDelegate; -@class NSTouchBarItem; - -@interface NSWindow (TouchBarSDK) -@property(strong, readonly) NSTouchBar* touchBar API_AVAILABLE(macosx(10.12.2)); -@end - -#endif // MAC_OS_X_VERSION_10_12_1 - -#endif // SHELL_BROWSER_UI_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_