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

Unified Diff: chrome/browser/extensions/extension_keybinding_registry.cc

Issue 788973002: Observe OnExtensionLoaded to trigger update of chrome.commands keybindings for component extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 5 years, 11 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
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_keybinding_registry.cc
diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc
index 3b239420ad39666d9dedf6be153d756104c48c69..22837a82a1b36a0831e0030efa77d2e29a56bb8c 100644
--- a/chrome/browser/extensions/extension_keybinding_registry.cc
+++ b/chrome/browser/extensions/extension_keybinding_registry.cc
@@ -197,10 +197,17 @@ void ExtensionKeybindingRegistry::Observe(
return;
if (ExtensionMatchesFilter(extension)) {
- if (type == extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED)
+ if (type == extensions::NOTIFICATION_EXTENSION_COMMAND_ADDED) {
+ // Component extensions triggers OnExtensionLoaded for extension
+ // installs as well as loads. This can cause adding of multiple key
+ // targets.
+ if (extension->location() == Manifest::COMPONENT)
+ return;
+
AddExtensionKeybindings(extension, payload->command_name);
- else
+ } else {
RemoveExtensionKeybinding(extension, payload->command_name);
+ }
}
break;
}
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698