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

Side by Side Diff: chrome/browser/ui/cocoa/chrome_event_processing_window.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/chrome_event_processing_window.h" 5 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/foundation_util.h" 8 #import "base/mac/foundation_util.h"
9 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
10 #import "chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.h" 10 #import "chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 - (BOOL)redispatchKeyEvent:(NSEvent*)event { 48 - (BOOL)redispatchKeyEvent:(NSEvent*)event {
49 return [commandDispatcher_ redispatchKeyEvent:event]; 49 return [commandDispatcher_ redispatchKeyEvent:event];
50 } 50 }
51 51
52 - (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event { 52 - (BOOL)defaultPerformKeyEquivalent:(NSEvent*)event {
53 return [super performKeyEquivalent:event]; 53 return [super performKeyEquivalent:event];
54 } 54 }
55 55
56 - (BOOL)defaultValidateUserInterfaceItem:
57 (id<NSValidatedUserInterfaceItem>)item {
58 return [super validateUserInterfaceItem:item];
59 }
60
56 - (void)commandDispatch:(id)sender { 61 - (void)commandDispatch:(id)sender {
57 [commandHandler_ commandDispatch:sender window:self]; 62 [commandDispatcher_ dispatch:sender forHandler:commandHandler_];
58 } 63 }
59 64
60 - (void)commandDispatchUsingKeyModifiers:(id)sender { 65 - (void)commandDispatchUsingKeyModifiers:(id)sender {
61 [commandHandler_ commandDispatchUsingKeyModifiers:sender window:self]; 66 [commandDispatcher_ dispatchUsingKeyModifiers:sender
67 forHandler:commandHandler_];
62 } 68 }
63 69
64 // NSWindow overrides. 70 // NSWindow overrides.
65 71
66 - (BOOL)performKeyEquivalent:(NSEvent*)event { 72 - (BOOL)performKeyEquivalent:(NSEvent*)event {
67 return [commandDispatcher_ performKeyEquivalent:event]; 73 return [commandDispatcher_ performKeyEquivalent:event];
68 } 74 }
69 75
70 - (void)sendEvent:(NSEvent*)event { 76 - (void)sendEvent:(NSEvent*)event {
71 if (![commandDispatcher_ preSendEvent:event]) 77 if (![commandDispatcher_ preSendEvent:event])
72 [super sendEvent:event]; 78 [super sendEvent:event];
73 } 79 }
74 80
75 // NSWindow overrides (NSUserInterfaceValidations implementation). 81 // NSWindow overrides (NSUserInterfaceValidations implementation).
76 82
77 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { 83 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
78 // Since this class implements these selectors, |super| will always say they 84 return [commandDispatcher_ validateUserInterfaceItem:item
79 // are enabled. Only use [super] to validate other selectors. If there is no 85 forHandler:commandHandler_];
80 // command handler, defer to AppController.
81 if ([item action] == @selector(commandDispatch:) ||
82 [item action] == @selector(commandDispatchUsingKeyModifiers:)) {
83 if (commandHandler_)
84 return [commandHandler_ validateUserInterfaceItem:item window:self];
85
86 AppController* appController =
87 base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
88 return [appController validateUserInterfaceItem:item];
89 }
90
91 return [super validateUserInterfaceItem:item];
92 } 86 }
93 87
94 @end // ChromeEventProcessingWindow 88 @end // ChromeEventProcessingWindow
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698