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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 370293004: mac: Load the system hotkeys after launch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Histograms and dchecks. 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: content/browser/renderer_host/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 5fd0b1b2e23be0b57cb740280dfa3cab11645c7b..e29590b1a577c4092543cc0ca4f59d178977e317 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2517,6 +2517,10 @@ void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) {
if ([[self window] firstResponder] != self)
return NO;
+ // If the event is reserved by the system, then do not pass it to web content.
+ if ([responderDelegate_ eventIsReservedBySystem:theEvent])
+ return NO;
+
// If we return |NO| from this function, cocoa will send the key event to
// the menu and only if the menu does not process the event to |keyDown:|. We
// want to send the event to a renderer _before_ sending it to the menu, so
@@ -2564,6 +2568,18 @@ void RenderWidgetHostViewMac::AcceleratedLayerDidDrawFrame(bool succeeded) {
- (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv {
TRACE_EVENT0("browser", "RenderWidgetHostViewCocoa::keyEvent");
+
+ // If the user changes the system hotkey mapping after Chrome has been
+ // launched, then it is possible that a formerly reserved system hotkey is no
+ // longer reserved. The hotkey would have skipped the renderer, but would
+ // also have not been handled by the system. If this is the case, immediately
+ // return.
+ // TODO(erikchen): SystemHotkeyHelperMac should use FS api to monitor changes
+ // to system hotkeys. This logic will have to be updated.
+ // http://crbug.com/383558.
+ if ([responderDelegate_ eventIsReservedBySystem:theEvent])
+ return;
+
DCHECK([theEvent type] != NSKeyDown ||
!equiv == !([theEvent modifierFlags] & NSCommandKeyMask));

Powered by Google App Engine
This is Rietveld 408576698