| OLD | NEW |
| 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/bridged_native_widget.h" | 8 #import "ui/views/cocoa/bridged_native_widget.h" |
| 9 #import "ui/base/cocoa/user_interface_item_command_handler.h" | 9 #import "ui/base/cocoa/user_interface_item_command_handler.h" |
| 10 #import "ui/views/cocoa/views_nswindow_delegate.h" | 10 #import "ui/views/cocoa/views_nswindow_delegate.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 // NSWindow overrides (NSUserInterfaceItemValidations implementation) | 194 // NSWindow overrides (NSUserInterfaceItemValidations implementation) |
| 195 | 195 |
| 196 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { | 196 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
| 197 // Since this class implements these selectors, |super| will always say they | 197 // Since this class implements these selectors, |super| will always say they |
| 198 // are enabled. Only use [super] to validate other selectors. If there is no | 198 // are enabled. Only use [super] to validate other selectors. If there is no |
| 199 // command handler, defer to AppController. | 199 // command handler, defer to AppController. |
| 200 if ([item action] == @selector(commandDispatch:) || | 200 if ([item action] == @selector(commandDispatch:) || |
| 201 [item action] == @selector(commandDispatchUsingKeyModifiers:)) { | 201 [item action] == @selector(commandDispatchUsingKeyModifiers:)) { |
| 202 return commandHandler_ | 202 if (commandHandler_) |
| 203 ? [commandHandler_ validateUserInterfaceItem:item window:self] | 203 return [commandHandler_ validateUserInterfaceItem:item window:self]; |
| 204 : [[NSApp delegate] validateUserInterfaceItem:item]; | 204 |
| 205 id appController = [NSApp delegate]; |
| 206 DCHECK([appController |
| 207 conformsToProtocol:@protocol(NSUserInterfaceValidations)]); |
| 208 return [appController validateUserInterfaceItem:item]; |
| 205 } | 209 } |
| 206 | 210 |
| 207 return [super validateUserInterfaceItem:item]; | 211 return [super validateUserInterfaceItem:item]; |
| 208 } | 212 } |
| 209 | 213 |
| 210 @end | 214 @end |
| OLD | NEW |