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

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

Issue 1255783002: [Mac] Factor out keyboard shortcut handling from ChromeEventProcessingWindow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@execute
Patch Set: Fix a few things. Created 5 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/browser_window_utils.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_utils.mm b/chrome/browser/ui/cocoa/browser_window_utils.mm
index 2a63941522accefc8ddb13b11d8cbcad7934f496..b35d395f1222b07f697655498a641a4fe6f1d14c 100644
--- a/chrome/browser/ui/cocoa/browser_window_utils.mm
+++ b/chrome/browser/ui/cocoa/browser_window_utils.mm
@@ -7,9 +7,11 @@
#include <Carbon/Carbon.h>
#include "base/logging.h"
+#import "base/mac/foundation_util.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/global_keyboard_shortcuts_mac.h"
#include "chrome/browser/ui/browser.h"
+#import "chrome/browser/ui/cocoa/chrome_command_dispatch_delegate.h"
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
#include "content/public/browser/native_web_keyboard_event.h"
@@ -31,8 +33,10 @@ using content::NativeWebKeyboardEvent;
+ (BOOL)handleKeyboardEvent:(NSEvent*)event
inWindow:(NSWindow*)window {
ChromeEventProcessingWindow* event_window =
- static_cast<ChromeEventProcessingWindow*>(window);
- DCHECK([event_window isKindOfClass:[ChromeEventProcessingWindow class]]);
+ base::mac::ObjCCastStrict<ChromeEventProcessingWindow>(window);
+ ChromeCommandDispatchDelegate* command_delegate =
+ base::mac::ObjCCastStrict<ChromeCommandDispatchDelegate>(
+ [event_window commandDelegate]);
// Do not fire shortcuts on key up.
if ([event type] == NSKeyDown) {
@@ -45,7 +49,7 @@ using content::NativeWebKeyboardEvent;
if ([[NSApp mainMenu] performKeyEquivalent:event])
return true;
- if ([event_window handleExtraKeyboardShortcut:event])
+ if ([command_delegate handleExtraKeyboardShortcut:event window:window])
tapted 2015/07/31 03:06:49 If it's cleaner, I think it's OK to leave handleEx
jackhou1 2015/08/04 01:03:58 Done.
return true;
}

Powered by Google App Engine
This is Rietveld 408576698