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

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

Issue 388313002: mac: Allow WebContents key handling to supplant extension overrides of the bookmark shortcut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from yoz and shess. Created 6 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/extensions/extension_keybinding_registry_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm b/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm
index 4f6e93d667573192a0d072545e788f40cf8e8ee5..35ff743009f10fc0b84d7941f089eae4da8d94ab 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.mm
@@ -8,6 +8,7 @@
#include "chrome/browser/extensions/api/commands/command_service.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/extensions/accelerator_priority.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/notification_service.h"
#include "extensions/common/extension.h"
@@ -38,7 +39,8 @@ ExtensionKeybindingRegistryCocoa::~ExtensionKeybindingRegistryCocoa() {
}
bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent(
- const content::NativeWebKeyboardEvent& event) {
+ const content::NativeWebKeyboardEvent& event,
+ ui::AcceleratorManager::HandlerPriority priority) {
if (shortcut_handling_suspended_)
return false;
@@ -51,6 +53,12 @@ bool ExtensionKeybindingRegistryCocoa::ProcessKeyEvent(
if (!GetFirstTarget(accelerator, &extension_id, &command_name))
return false;
+ const ui::AcceleratorManager::HandlerPriority accelerator_priority =
+ GetAcceleratorPriorityById(accelerator, extension_id, profile_);
+ // Only handle the event if it has the right priority.
+ if (priority != accelerator_priority)
+ return false;
+
int type = 0;
if (command_name == values::kPageActionCommandEvent) {
type = chrome::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC;

Powered by Google App Engine
This is Rietveld 408576698