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

Unified Diff: ui/base/cocoa/touch_bar_util.mm

Issue 2921083003: [Mac] Touch Bar Support for Dialogs (Closed)
Patch Set: Added test and renamed methods Created 3 years, 6 months 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/cocoa/touch_bar_util.h ('k') | ui/base/cocoa/touch_bar_util_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/touch_bar_util.mm
diff --git a/ui/base/cocoa/touch_bar_util.mm b/ui/base/cocoa/touch_bar_util.mm
new file mode 100644
index 0000000000000000000000000000000000000000..e4986f2a334473727576558364aa7f75bf65cee5
--- /dev/null
+++ b/ui/base/cocoa/touch_bar_util.mm
@@ -0,0 +1,42 @@
+// Copyright 2017 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.
+
+#import "ui/base/cocoa/touch_bar_util.h"
+
+#include "base/mac/foundation_util.h"
+#include "base/mac/sdk_forward_declarations.h"
+#include "base/strings/sys_string_conversions.h"
+
+namespace ui {
+
+Class NSTouchBar() {
+ return NSClassFromString(@"NSTouchBar");
+}
+
+Class NSCustomTouchBarItem() {
+ return NSClassFromString(@"NSCustomTouchBarItem");
+}
+
+NSButton* GetBlueTouchBarButton(NSString* title, id target, SEL action) {
+ NSButton* button =
+ [NSButton buttonWithTitle:title target:target action:action];
+ [button setBezelColor:[NSColor colorWithSRGBRed:0.168
+ green:0.51
+ blue:0.843
+ alpha:1.0]];
+ return button;
+}
+
+NSString* GetTouchBarId(NSString* touch_bar_id) {
+ NSString* chrome_bundle_id =
+ base::SysUTF8ToNSString(base::mac::BaseBundleID());
+ return [NSString stringWithFormat:@"%@.%@", chrome_bundle_id, touch_bar_id];
+}
+
+NSString* GetTouchBarItemId(NSString* touch_bar_id, NSString* item_id) {
+ return [NSString
+ stringWithFormat:@"%@-%@", GetTouchBarId(touch_bar_id), item_id];
+}
+
+} // namespace ui
« no previous file with comments | « ui/base/cocoa/touch_bar_util.h ('k') | ui/base/cocoa/touch_bar_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698