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

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

Issue 300002: Short-circuit events rwhvmac if it's focussed. (Closed)
Patch Set: refine Created 11 years, 2 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/cocoa/chrome_event_processing_window.mm
diff --git a/chrome/browser/cocoa/chrome_event_processing_window.mm b/chrome/browser/cocoa/chrome_event_processing_window.mm
index 7a82ab44f6b9dd1685f77666999ccbe30c94d3e5..8633c1c2f81bf319863d6838685e02d4bd0d938d 100644
--- a/chrome/browser/cocoa/chrome_event_processing_window.mm
+++ b/chrome/browser/cocoa/chrome_event_processing_window.mm
@@ -51,15 +51,16 @@ typedef int (*KeyToCommandMapper)(bool, bool, bool, int);
}
- (BOOL)performKeyEquivalent:(NSEvent*)event {
- // 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];
- if ([r isKindOfClass:[RenderWidgetHostViewCocoa class]])
- return [r performKeyEquivalent:event];
+ // We have some magic in |CrApplication sendEvent:| that always sends key
+ // events to |RWHVCocoa keyEvent:| so that cocoa doesn't have a chance to
+ // intercept it.
+ DCHECK(![[self firstResponder]
+ isKindOfClass:[RenderWidgetHostViewCocoa class]]);
// Handle per-window shortcuts like cmd-1, but do not handle browser-level
// shortcuts like cmd-left (else, cmd-left would do history navigation even
- // if e.g. the Omnibox has focus).
+ // if e.g. the Omnibox has focus). If the web has focus, don't do this here,
+ // since the web needs to get a chance at swallowing the event first.
if ([self handleExtraWindowKeyboardShortcut:event])
return YES;
return [super performKeyEquivalent:event];

Powered by Google App Engine
This is Rietveld 408576698