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

Unified Diff: chrome/browser/ui/cocoa/chrome_event_processing_window.mm

Issue 388313002: mac: Allow WebContents key handling to supplant extension overrides of the bookmark shortcut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from yoz and shess. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/chrome_event_processing_window.mm
diff --git a/chrome/browser/ui/cocoa/chrome_event_processing_window.mm b/chrome/browser/ui/cocoa/chrome_event_processing_window.mm
index 85e0cc704c07b99faf0d543b0df0c76d1183f477..43d0feb3e9e780e7edcab49776bfd9e51770bc2d 100644
--- a/chrome/browser/ui/cocoa/chrome_event_processing_window.mm
+++ b/chrome/browser/ui/cocoa/chrome_event_processing_window.mm
@@ -61,18 +61,25 @@ typedef int (*KeyToCommandMapper)(bool, bool, bool, bool, int, unichar);
}
- (BOOL)performKeyEquivalent:(NSEvent*)event {
- if (redispatchingEvent_)
- return NO;
-
+ // Some extension commands have higher priority than web content, and some
+ // have lower priority. Regardless of whether the event is being
+ // redispatched, let the extension system try to handle the event.
NSWindow* window = event.window;
if (window) {
BrowserWindowController* controller = [window windowController];
- if ([controller respondsToSelector:@selector(handledByExtensionCommand:)]) {
- if ([controller handledByExtensionCommand:event])
+ if ([controller respondsToSelector:@selector(handledByExtensionCommand:
+ priority:)]) {
+ ui::AcceleratorManager::HandlerPriority priority =
+ redispatchingEvent_ ? ui::AcceleratorManager::kNormalPriority
+ : ui::AcceleratorManager::kHighPriority;
+ if ([controller handledByExtensionCommand:event priority:priority])
return YES;
}
}
+ if (redispatchingEvent_)
+ return NO;
+
// Give the web site a chance to handle the event. If it doesn't want to
// handle it, it will call us back with one of the |handle*| methods above.
NSResponder* r = [self firstResponder];

Powered by Google App Engine
This is Rietveld 408576698