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

Unified Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm

Issue 10911020: Enable commands API for platform apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: filter by extension type instead of specific extensions Created 8 years, 4 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/extensions/shell_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
index 18a7d380ab781b883936bde36970c38e74c502b9..a2983732d18b21cc40ebca274e25d9902a3eb52d 100644
--- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm
@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/cocoa/browser_window_utils.h"
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
+#include "chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.h"
#include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/extensions/extension.h"
@@ -77,6 +78,12 @@
// No-op, swallow the event.
}
+- (BOOL)handledByExtensionCommand:(NSEvent*)event {
+ if (shellWindow_)
+ return shellWindow_->HandledByExtensionCommand(event);
+ return NO;
+}
+
@end
@interface ShellNSWindow : ChromeEventProcessingWindow
@@ -170,6 +177,10 @@ ShellWindowCocoa::ShellWindowCocoa(ShellWindow* shell_window,
[[window_controller_ window] setDelegate:window_controller_];
[window_controller_ setShellWindow:this];
+
+ extension_keybinding_registry_.reset(
+ new ExtensionKeybindingRegistryCocoa(shell_window_->profile(), window,
+ extensions::ExtensionKeybindingRegistry::PLATFORM_APP_ONLY));
}
void ShellWindowCocoa::InstallView() {
@@ -452,6 +463,11 @@ void ShellWindowCocoa::WindowDidResignKey() {
rwhv->SetActive(false);
}
+bool ShellWindowCocoa::HandledByExtensionCommand(NSEvent* event) {
+ return extension_keybinding_registry_->ProcessKeyEvent(
+ content::NativeWebKeyboardEvent(event));
+}
+
ShellWindowCocoa::~ShellWindowCocoa() {
}

Powered by Google App Engine
This is Rietveld 408576698