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

Side by Side Diff: ui/views/cocoa/native_widget_mac_nswindow.mm

Issue 2666523002: Allow permission bubbles to participate in key event dispatch as if they were a Browser. (Closed)
Patch Set: comments, fix permission->type missed in a refactor Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/base/cocoa/command_dispatcher.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/mac/sdk_forward_declarations.h" 8 #import "base/mac/sdk_forward_declarations.h"
9 #import "ui/views/cocoa/bridged_native_widget.h" 9 #import "ui/views/cocoa/bridged_native_widget.h"
10 #import "ui/base/cocoa/user_interface_item_command_handler.h" 10 #import "ui/base/cocoa/user_interface_item_command_handler.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 192
193 - (BOOL)redispatchKeyEvent:(NSEvent*)event { 193 - (BOOL)redispatchKeyEvent:(NSEvent*)event {
194 return [commandDispatcher_ redispatchKeyEvent:event]; 194 return [commandDispatcher_ redispatchKeyEvent:event];
195 } 195 }
196 196
197 - (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event { 197 - (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event {
198 return [super performKeyEquivalent:event]; 198 return [super performKeyEquivalent:event];
199 } 199 }
200 200
201 - (BOOL)defaultValidateUserInterfaceItem:
202 (id<NSValidatedUserInterfaceItem>)item {
203 return [super validateUserInterfaceItem:item];
204 }
205
201 - (void)commandDispatch:(id)sender { 206 - (void)commandDispatch:(id)sender {
202 [commandHandler_ commandDispatch:sender window:self]; 207 [commandDispatcher_ dispatch:sender forHandler:commandHandler_];
203 } 208 }
204 209
205 - (void)commandDispatchUsingKeyModifiers:(id)sender { 210 - (void)commandDispatchUsingKeyModifiers:(id)sender {
206 [commandHandler_ commandDispatchUsingKeyModifiers:sender window:self]; 211 [commandDispatcher_ dispatchUsingKeyModifiers:sender
212 forHandler:commandHandler_];
207 } 213 }
208 214
209 // NSWindow overrides (NSUserInterfaceItemValidations implementation) 215 // NSWindow overrides (NSUserInterfaceItemValidations implementation)
210 216
211 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 217 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
212 // Since this class implements these selectors, |super| will always say they 218 return [commandDispatcher_ validateUserInterfaceItem:item
213 // are enabled. Only use [super] to validate other selectors. If there is no 219 forHandler:commandHandler_];
214 // command handler, defer to AppController.
215 if ([item action] == @selector(commandDispatch:) ||
216 [item action] == @selector(commandDispatchUsingKeyModifiers:)) {
217 if (commandHandler_)
218 return [commandHandler_ validateUserInterfaceItem:item window:self];
219
220 id appController = [NSApp delegate];
221 DCHECK([appController
222 conformsToProtocol:@protocol(NSUserInterfaceValidations)]);
223 return [appController validateUserInterfaceItem:item];
224 }
225
226 return [super validateUserInterfaceItem:item];
227 } 220 }
228 221
229 @end 222 @end
OLDNEW
« no previous file with comments | « ui/base/cocoa/command_dispatcher.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698