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 0f077fe12b65c90ba4126e6ba6496e134b0071f7..134c914f4da00a93943e73359aa9a36d5031ff84 100644 |
--- a/ui/views/cocoa/native_widget_mac_nswindow.mm |
+++ b/ui/views/cocoa/native_widget_mac_nswindow.mm |
@@ -198,32 +198,25 @@ |
return [super performKeyEquivalent:event]; |
} |
+- (BOOL)defaultValidateUserInterfaceItem: |
+ (id<NSValidatedUserInterfaceItem>)item { |
+ return [super validateUserInterfaceItem:item]; |
+} |
+ |
- (void)commandDispatch:(id)sender { |
- [commandHandler_ commandDispatch:sender window:self]; |
+ [commandDispatcher_ dispatch:sender forHandler:commandHandler_]; |
} |
- (void)commandDispatchUsingKeyModifiers:(id)sender { |
- [commandHandler_ commandDispatchUsingKeyModifiers:sender window:self]; |
+ [commandDispatcher_ dispatchUsingKeyModifiers:sender |
+ forHandler:commandHandler_]; |
} |
// NSWindow overrides (NSUserInterfaceItemValidations implementation) |
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
- // Since this class implements these selectors, |super| will always say they |
- // are enabled. Only use [super] to validate other selectors. If there is no |
- // command handler, defer to AppController. |
- if ([item action] == @selector(commandDispatch:) || |
- [item action] == @selector(commandDispatchUsingKeyModifiers:)) { |
- if (commandHandler_) |
- return [commandHandler_ validateUserInterfaceItem:item window:self]; |
- |
- id appController = [NSApp delegate]; |
- DCHECK([appController |
- conformsToProtocol:@protocol(NSUserInterfaceValidations)]); |
- return [appController validateUserInterfaceItem:item]; |
- } |
- |
- return [super validateUserInterfaceItem:item]; |
+ return [commandDispatcher_ validateUserInterfaceItem:item |
+ forHandler:commandHandler_]; |
} |
@end |