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

Side by Side Diff: ui/views/cocoa/native_widget_mac_nswindow.mm

Issue 1259513002: [MacViews] Use ChromeCommandDispatcherDelegate to handle keyboard shortcuts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@commandexecute
Patch Set: Sync. Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ui/views/cocoa/native_widget_mac_nswindow.h" 5 #import "ui/views/cocoa/native_widget_mac_nswindow.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #import "ui/views/cocoa/views_nswindow_delegate.h" 8 #import "ui/views/cocoa/views_nswindow_delegate.h"
9 #include "ui/views/controls/menu/menu_controller.h" 9 #include "ui/views/controls/menu/menu_controller.h"
10 #include "ui/views/widget/native_widget_mac.h" 10 #include "ui/views/widget/native_widget_mac.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return menuController && menuController->owner() == [self viewsWidget]; 49 return menuController && menuController->owner() == [self viewsWidget];
50 } 50 }
51 51
52 - (BOOL)_isTitleHidden { 52 - (BOOL)_isTitleHidden {
53 if (![self delegate]) 53 if (![self delegate])
54 return NO; 54 return NO;
55 55
56 return ![self viewsWidget]->widget_delegate()->ShouldShowWindowTitle(); 56 return ![self viewsWidget]->widget_delegate()->ShouldShowWindowTitle();
57 } 57 }
58 58
59 // Public methods.
tapted 2015/08/27 02:58:18 nit: should come before private methods (after ini
jackhou1 2015/08/27 22:37:48 Done.
60
61 - (void)setCommandDispatcherDelegate:(id<CommandDispatcherDelegate>)delegate {
62 [commandDispatcher_ setDelegate:delegate];
63 }
64
65 // NSWindow overrides.
tapted 2015/08/27 02:58:18 I think technically _isTitleHidden is an NSWindow
jackhou1 2015/08/27 22:37:47 Done.
66
59 // Ignore [super canBecome{Key,Main}Window]. The default is NO for windows with 67 // Ignore [super canBecome{Key,Main}Window]. The default is NO for windows with
60 // NSBorderlessWindowMask, which is not the desired behavior. 68 // NSBorderlessWindowMask, which is not the desired behavior.
61 // Note these can be called via -[NSWindow close] while the widget is being torn 69 // Note these can be called via -[NSWindow close] while the widget is being torn
62 // down, so check for a delegate. 70 // down, so check for a delegate.
63 - (BOOL)canBecomeKeyWindow { 71 - (BOOL)canBecomeKeyWindow {
64 return [self delegate] && [self viewsWidget]->CanActivate(); 72 return [self delegate] && [self viewsWidget]->CanActivate();
65 } 73 }
66 74
67 - (BOOL)canBecomeMainWindow { 75 - (BOOL)canBecomeMainWindow {
68 if (![self delegate]) 76 if (![self delegate])
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 157
150 - (BOOL)redispatchKeyEvent:(NSEvent*)event { 158 - (BOOL)redispatchKeyEvent:(NSEvent*)event {
151 return [commandDispatcher_ redispatchKeyEvent:event]; 159 return [commandDispatcher_ redispatchKeyEvent:event];
152 } 160 }
153 161
154 - (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event { 162 - (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event {
155 return [super performKeyEquivalent:event]; 163 return [super performKeyEquivalent:event];
156 } 164 }
157 165
158 @end 166 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698