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

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

Issue 251069: Support cmd-left/right for history. (Closed)
Patch Set: comments 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/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 c560fb64d613814b7239a89b0d917bae0da6890d..19a93c500fa7aa66cc85514970ba4f49de489545 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -8,6 +8,9 @@
#include "chrome/browser/browser.h" // TODO(beng): this dependency is awful.
#import "chrome/browser/cocoa/focus_tracker.h"
+#import "chrome/browser/cocoa/chrome_browser_window.h"
+#import "chrome/browser/cocoa/browser_window_controller.h"
+#include "chrome/browser/global_keyboard_shortcuts_mac.h"
#include "chrome/browser/cocoa/sad_tab_view.h"
#import "chrome/browser/cocoa/web_drag_source.h"
#import "chrome/browser/cocoa/web_drop_target.h"
@@ -294,6 +297,18 @@ void TabContentsViewMac::Observe(NotificationType type,
}
- (void)processKeyboardEvent:(NSEvent*)event {
+ // If this tab is no longer active, it's window will be |nil|. In that case,
+ // best ignore the event.
+ if (![self window])
+ return;
+
+ ChromeBrowserWindow* window = (ChromeBrowserWindow*)[self window];
+ DCHECK([window isKindOfClass:[ChromeBrowserWindow class]]);
+ if ([window handleExtraBrowserKeyboardShortcut:event])
+ return;
+ if ([window handleExtraWindowKeyboardShortcut:event])
+ return;
+
if ([event type] == NSKeyDown)
[super keyDown:event];
else if ([event type] == NSKeyUp)

Powered by Google App Engine
This is Rietveld 408576698