Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: ui/base/cocoa/touch_bar_forward_declarations.h

Issue 2469213002: MacViews: TouchBar integration for toolkit-views dialogs. (Closed)
Patch Set: : -> in Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/touch_bar_forward_declarations.h
diff --git a/ui/base/cocoa/touch_bar_forward_declarations.h b/ui/base/cocoa/touch_bar_forward_declarations.h
new file mode 100644
index 0000000000000000000000000000000000000000..54c68ae534ba473664f61d8cdc69de1982752224
--- /dev/null
+++ b/ui/base/cocoa/touch_bar_forward_declarations.h
@@ -0,0 +1,59 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_
+#define UI_BASE_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_
+
+// Once Chrome no longer supports OSX 10.12.0, this file can be deleted.
+
+#import <Foundation/Foundation.h>
+
+#if !defined(MAC_OS_X_VERSION_10_12_1)
+
+// The TouchBar classes do not exist at all without the 10.12.1 SDK. When
+// compiling with older SDKs, pretend they are NSObject and add categories to
+// NSObject to expose the methods.
+// To alloc one of these classes, use -[NSClassFromString(@"..") alloc].
+
+// Incomplete. Add more as necessary.
+
+typedef NSObject NSCustomTouchBarItem;
+typedef NSObject NSGroupTouchBarItem;
+typedef NSObject NSTouchBar;
+typedef NSObject NSTouchBarItem;
+typedef NSString* NSTouchBarItemIdentifier;
+
+@protocol NSTouchBarDelegate<NSObject>
+@end
+
+@interface NSObject (FakeNSCustomTouchBarItem)
+@property(readwrite, strong) NSView* view;
+@end
+
+@interface NSObject (FakeNSGroupTouchBarItem)
++ (NSGroupTouchBarItem*)groupItemWithIdentifier:
+ (NSTouchBarItemIdentifier)identifier
+ items:(NSArray*)items;
+@end
+
+@interface NSObject (FakeNSTouchBar)
+@property(copy) NSArray* defaultItemIdentifiers;
+@property(copy) NSTouchBarItemIdentifier principalItemIdentifier;
+@property(weak) id<NSTouchBarDelegate> delegate;
+@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;
+
+#endif // MAC_OS_X_VERSION_10_12_1
+
+#endif // UI_BASE_COCOA_TOUCH_BAR_FORWARD_DECLARATIONS_H_
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/views/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698