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..8e387323b0ee5f07d7424edbab4739725c69273c 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 |
@@ -89,6 +90,39 @@ 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 |
+ |
+// Used by CommandDispatchingWindow to implement UI item validation. |
+@protocol UserInterfaceItemCommandHandler |
+ |
+// Called by CommandDispatchingWindow to validate menu and toolbar items. All |
+// the items we care about have been set with the -commandDispatch or |
+// -commandDispatchUsingKeyModifiers selectors and a target of FirstResponder in |
+// IB. If it's not one of those, it should be handled elsewhere in the responder |
+// chain. |
+- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item |
+ window:(NSWindow*)window; |
+ |
+// Called by CommandDispatchingWindow to execute commands. This assumes that the |
+// command is supported and doesn't check, otherwise it would have been disabled |
+// in the UI in validateUserInterfaceItem:. |
+- (void)commandDispatch:(id)sender window:(NSWindow*)window; |
+ |
+// Same as |-commandDispatch:|, but executes commands using a disposition |
+// determined by the key flags. If the window is in the background and the |
+// command key is down, ignore the command key, but process any other modifiers. |
+- (void)commandDispatchUsingKeyModifiers:(id)sender window:(NSWindow*)window; |
+ |
@end |
#endif // UI_BASE_COCOA_COMMAND_DISPATCHER_H_ |