Move NSTouchBarDelegate to AtomNSWindowDelegate

This commit is contained in:
Cheng Zhao 2018-04-19 16:18:50 +09:00
parent 8e9667d86c
commit f6a7e5ea23
3 changed files with 20 additions and 13 deletions

View file

@ -11,7 +11,8 @@ namespace atom {
class NativeWindowMac;
}
@interface AtomNSWindowDelegate : NSObject<NSWindowDelegate> {
@interface AtomNSWindowDelegate : NSObject<NSWindowDelegate,
NSTouchBarDelegate> {
@private
atom::NativeWindowMac* shell_;
bool is_zooming_;

View file

@ -6,6 +6,7 @@
#include "atom/browser/browser.h"
#include "atom/browser/native_window_mac.h"
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
#include "base/mac/mac_util.h"
@implementation AtomNSWindowDelegate
@ -19,6 +20,8 @@
return self;
}
#pragma mark - NSWindowDelegate
- (void)windowDidChangeOcclusionState:(NSNotification *)notification {
// notification.object is the window that changed its state.
// It's safe to use self.window instead if you don't assign one delegate to many windows
@ -246,4 +249,14 @@
atom::Browser::Get()->NewWindowForTab();
}
#pragma mark - NSTouchBarDelegate
- (NSTouchBarItem*)touchBar:(NSTouchBar*)touchBar
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier API_AVAILABLE(macosx(10.12.2)) {
if (touchBar && shell_->atom_touch_bar())
return [shell_->atom_touch_bar() makeItemForIdentifier:identifier];
else
return nil;
}
@end