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

Unified Diff: ui/base/cocoa/command_dispatcher.h

Issue 1250403002: [Mac] Move UI item validation to UserInterfaceItemCommandHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@commandexecute
Patch Set: Properly release |commandHandler|. 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
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/cocoa/user_interface_item_command_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/command_dispatcher.h
diff --git a/ui/base/cocoa/command_dispatcher.h b/ui/base/cocoa/command_dispatcher.h
index 8ad679af00ed3df90039e57332e870e8f88714ac..0212d1e2ccc505a070cea14729eb8366e1945cfa 100644
--- a/ui/base/cocoa/command_dispatcher.h
+++ b/ui/base/cocoa/command_dispatcher.h
@@ -12,6 +12,7 @@
@protocol CommandDispatcherDelegate;
@protocol CommandDispatchingWindow;
+@protocol UserInterfaceItemCommandHandler;
// CommandDispatcher guides the processing of key events to ensure key commands
// are executed in the appropriate order. In particular, it allows a first
@@ -81,6 +82,11 @@ UI_BASE_EXPORT @interface CommandDispatcher : NSObject
// CommandDispatcher.
@protocol CommandDispatchingWindow
+// If set, NSUserInterfaceItemValidations for -commandDispatch: and
+// -commandDispatchUsingKeyModifiers: will be redirected to the command handler.
+// Retains |commandHandler|.
+-(void)setCommandHandler:(id<UserInterfaceItemCommandHandler>) commandHandler;
+
// This can be implemented with -[CommandDispatcher redispatchKeyEvent:]. It's
// so that callers can simply return events to the NSWindow.
- (BOOL)redispatchKeyEvent:(NSEvent*)event;
@@ -89,6 +95,16 @@ UI_BASE_EXPORT @interface CommandDispatcher : NSObject
// CommandDispatcher calls as part of its -performKeyEquivalent: flow.
- (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event;
+// AppKit will call -[NSUserInterfaceValidations validateUserInterfaceItem:] to
+// validate UI items. Any item whose target is FirstResponder, or nil, will
+// traverse the responder chain looking for a responder that implements the
+// item's selector. Thus NSWindow is usually the last to be checked and will
+// handle any items that are not validated elsewhere in the chain. Implement the
+// following so that menu items with these selectors are validated by
+// CommandDispatchingWindow.
+- (void)commandDispatch:(id)sender;
+- (void)commandDispatchUsingKeyModifiers:(id)sender;
+
@end
#endif // UI_BASE_COCOA_COMMAND_DISPATCHER_H_
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/cocoa/user_interface_item_command_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698