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

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: rebase Created 8 years, 3 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 88b5c4fe3c896e524d508c0e4d53d8922565e3b1..82cb3378718185d15da4ecfd21ee199dfeace9f3 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
@@ -199,6 +206,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_APPS_ONLY));
}
void ShellWindowCocoa::InstallView() {
@@ -495,6 +506,11 @@ void ShellWindowCocoa::WindowDidMove() {
shell_window_->SaveWindowPosition();
}
+bool ShellWindowCocoa::HandledByExtensionCommand(NSEvent* event) {
+ return extension_keybinding_registry_->ProcessKeyEvent(
+ content::NativeWebKeyboardEvent(event));
+}
+
ShellWindowCocoa::~ShellWindowCocoa() {
}

Powered by Google App Engine
This is Rietveld 408576698