| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 #import "ui/base/cocoa/touch_bar_util.h" |
| 6 |
| 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" |
| 9 #include "base/strings/sys_string_conversions.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 Class NSTouchBar() { |
| 14 return NSClassFromString(@"NSTouchBar"); |
| 15 } |
| 16 |
| 17 Class NSCustomTouchBarItem() { |
| 18 return NSClassFromString(@"NSCustomTouchBarItem"); |
| 19 } |
| 20 |
| 21 NSButton* GetBlueTouchBarButton(NSString* title, id target, SEL action) { |
| 22 NSButton* button = |
| 23 [NSButton buttonWithTitle:title target:target action:action]; |
| 24 [button setBezelColor:[NSColor colorWithSRGBRed:0.168 |
| 25 green:0.51 |
| 26 blue:0.843 |
| 27 alpha:1.0]]; |
| 28 return button; |
| 29 } |
| 30 |
| 31 NSString* GetTouchBarId(NSString* touch_bar_id) { |
| 32 NSString* chrome_bundle_id = |
| 33 base::SysUTF8ToNSString(base::mac::BaseBundleID()); |
| 34 return [NSString stringWithFormat:@"%@.%@", chrome_bundle_id, touch_bar_id]; |
| 35 } |
| 36 |
| 37 NSString* GetTouchBarItemId(NSString* touch_bar_id, NSString* item_id) { |
| 38 return [NSString |
| 39 stringWithFormat:@"%@-%@", GetTouchBarId(touch_bar_id), item_id]; |
| 40 } |
| 41 |
| 42 } // namespace ui |
| OLD | NEW |