| 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
|
|
|