From aa5c80f8a60e795749a32bcee34e810722251705 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 20 Apr 2018 19:23:21 +0900 Subject: [PATCH] Fix new clang warnings --- atom/browser/native_window_mac.mm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 38b082208d0b..984a17dad582 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -1224,25 +1224,28 @@ void NativeWindowMac::SetVibrancy(const std::string& type) { void NativeWindowMac::SetTouchBar( const std::vector& items) { - if (![window_ respondsToSelector:@selector(touchBar)]) - return; - - touch_bar_.reset([[AtomTouchBar alloc] - initWithDelegate:window_delegate_.get() - window:this - settings:items]); - [window_ setTouchBar:nil]; + if (@available(macOS 10.12.2, *)) { + touch_bar_.reset([[AtomTouchBar alloc] + initWithDelegate:window_delegate_.get() + window:this + settings:items]); + [window_ setTouchBar:nil]; + } } void NativeWindowMac::RefreshTouchBarItem(const std::string& item_id) { - if (touch_bar_ && [window_ touchBar]) - [touch_bar_ refreshTouchBarItem:[window_ touchBar] id:item_id]; + if (@available(macOS 10.12.2, *)) { + if (touch_bar_ && [window_ touchBar]) + [touch_bar_ refreshTouchBarItem:[window_ touchBar] id:item_id]; + } } void NativeWindowMac::SetEscapeTouchBarItem( const mate::PersistentDictionary& item) { - if (touch_bar_ && [window_ touchBar]) - [touch_bar_ setEscapeTouchBarItem:item forTouchBar:[window_ touchBar]]; + if (@available(macOS 10.12.2, *)) { + if (touch_bar_ && [window_ touchBar]) + [touch_bar_ setEscapeTouchBarItem:item forTouchBar:[window_ touchBar]]; + } } gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds(