OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_BASE_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_ |
| 6 #define UI_BASE_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_ |
| 7 |
| 8 // Once Chrome no longer supports OSX 10.12.0, this file can be deleted. |
| 9 |
| 10 #import <Foundation/Foundation.h> |
| 11 |
| 12 #if !defined(MAC_OS_X_VERSION_10_12_1) |
| 13 |
| 14 // The TouchBar classes do not exist at all without the 10.12.1 SDK. When |
| 15 // compiling with older SDKs, pretend they are NSObject and add categories to |
| 16 // NSObject to expose the methods. |
| 17 // To alloc one of these classes, use -[NSClassFromString(@"..") alloc]. |
| 18 |
| 19 // Incomplete. Add more as necessary. |
| 20 |
| 21 typedef NSObject NSCustomTouchBarItem; |
| 22 typedef NSObject NSGroupTouchBarItem; |
| 23 typedef NSObject NSTouchBar; |
| 24 typedef NSObject NSTouchBarItem; |
| 25 typedef NSString* NSTouchBarItemIdentifier; |
| 26 |
| 27 @protocol NSTouchBarDelegate<NSObject> |
| 28 @end |
| 29 |
| 30 @interface NSObject (FakeNSCustomTouchBarItem) |
| 31 @property(readwrite, strong) NSView* view; |
| 32 @end |
| 33 |
| 34 @interface NSObject (FakeNSGroupTouchBarItem) |
| 35 + (NSGroupTouchBarItem*)groupItemWithIdentifier: |
| 36 (NSTouchBarItemIdentifier)identifier |
| 37 items:(NSArray*)items; |
| 38 @end |
| 39 |
| 40 @interface NSObject (FakeNSTouchBar) |
| 41 @property(copy) NSArray* defaultItemIdentifiers; |
| 42 @property(copy) NSTouchBarItemIdentifier principalItemIdentifier; |
| 43 @property(weak) id<NSTouchBarDelegate> delegate; |
| 44 @end |
| 45 |
| 46 #elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1 |
| 47 |
| 48 // When compiling against the 10.12.1 SDK or later, just provide forward |
| 49 // declarations to suppress the partial availability warnings. |
| 50 |
| 51 @class NSCustomTouchBarItem; |
| 52 @class NSGroupTouchBarItem; |
| 53 @class NSTouchBar; |
| 54 @protocol NSTouchBarDelegate; |
| 55 @class NSTouchBarItem; |
| 56 |
| 57 #endif // MAC_OS_X_VERSION_10_12_1 |
| 58 |
| 59 #endif // UI_BASE_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_ |
OLD | NEW |