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

Unified Diff: ui/views/cocoa/native_widget_mac_nswindow.mm

Issue 1250403002: [Mac] Move UI item validation to UserInterfaceItemCommandHandler. (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 side-by-side diff with in-line comments
Download patch
Index: ui/views/cocoa/native_widget_mac_nswindow.mm
diff --git a/ui/views/cocoa/native_widget_mac_nswindow.mm b/ui/views/cocoa/native_widget_mac_nswindow.mm
index 1de283fb956b7dc53d180ed36ec06e1e07d4ae91..9ef65daf887f10f4e9633a8dd4a3e6aa4f7a6d58 100644
--- a/ui/views/cocoa/native_widget_mac_nswindow.mm
+++ b/ui/views/cocoa/native_widget_mac_nswindow.mm
@@ -23,6 +23,7 @@
@implementation NativeWidgetMacNSWindow {
@private
base::scoped_nsobject<CommandDispatcher> commandDispatcher_;
+ id<UserInterfaceItemCommandHandler> commandHandler_;
}
- (instancetype)initWithContentRect:(NSRect)contentRect
@@ -44,6 +45,11 @@
[commandDispatcher_ setDelegate:delegate];
}
+- (void)setUserInterfaceItemCommandHandler:
+ (id<UserInterfaceItemCommandHandler>)commandHandler {
+ commandHandler_ = commandHandler;
+}
+
// Private methods.
- (ViewsNSWindowDelegate*)viewsNSWindowDelegate {
@@ -168,4 +174,16 @@
return [super performKeyEquivalent:event];
}
+- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
tapted 2015/09/03 04:15:38 same comments as on CEPW
jackhou1 2015/09/03 06:15:39 Done.
+ return [commandHandler_ validateUserInterfaceItem:item window:self];
+}
+
+- (void)commandDispatch:(id)sender {
+ [commandHandler_ commandDispatch:sender window:self];
+}
+
+- (void)commandDispatchUsingKeyModifiers:(id)sender {
+ [commandHandler_ commandDispatchUsingKeyModifiers:sender window:self];
+}
+
@end
« ui/views/cocoa/native_widget_mac_nswindow.h ('K') | « ui/views/cocoa/native_widget_mac_nswindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698