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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 242069: Send key equivalents to renderer first. (Closed)
Patch Set: comment 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
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_mac.mm
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 03baffc6fe004848ad63cf3614ab5e4eca084361..61195b1a72f8e49ce8341f5ebc75258fed1ad144 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -43,7 +43,7 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery);
@interface TabContentsViewCocoa (Private)
- (id)initWithTabContentsViewMac:(TabContentsViewMac*)w;
-- (void)processKeyboardEvent:(NSEvent*)event;
+- (void)processKeyboardEvent:(NativeWebKeyboardEvent*)event;
- (void)registerDragTypes;
- (void)setCurrentDragOperation:(NSDragOperation)operation;
- (void)startDragWithDropData:(const WebDropData&)dropData
@@ -202,7 +202,8 @@ void TabContentsViewMac::TakeFocus(bool reverse) {
void TabContentsViewMac::HandleKeyboardEvent(
const NativeWebKeyboardEvent& event) {
- [cocoa_view_.get() processKeyboardEvent:event.os_event];
+ [cocoa_view_.get() processKeyboardEvent:
+ const_cast<NativeWebKeyboardEvent*>(&event)];
}
void TabContentsViewMac::ShowContextMenu(const ContextMenuParams& params) {
@@ -293,7 +294,15 @@ void TabContentsViewMac::Observe(NotificationType type,
return tabContentsView_->tab_contents();
}
-- (void)processKeyboardEvent:(NSEvent*)event {
+- (void)processKeyboardEvent:(NativeWebKeyboardEvent*)wkEvent {
+ NSEvent* event = wkEvent->os_event;
+
+ if ([event type] == NSKeyDown && ([event modifierFlags] & NSCommandKeyMask)) {
+ // We need to dispatch this to the menu.
+ if ([[NSApp mainMenu] performKeyEquivalent:event])
+ return;
+ }
+
// If this tab is no longer active, it's window will be |nil|. In that case,
// best ignore the event.
if (![self window])
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698