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

Unified Diff: chrome/browser/extensions/api/commands/command_service.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: 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
Index: chrome/browser/extensions/api/commands/command_service.cc
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 33a522e04104bb5816b4e2fcae386448c0a9715d..f02f3b02cc1e1cc6e414b44f61596bf1a95c15dc 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -300,7 +300,10 @@ void CommandService::OnExtensionWillBeInstalled(
bool is_update,
bool from_ephemeral,
const std::string& old_name) {
- UpdateKeybindings(extension);
+ // Component extensions don't generate normal install and uninstall events so
+ // those are handled in loaded.
Finnur 2015/01/08 14:13:50 s/in loaded/in OnExtensionLoaded/
David Tseng 2015/01/08 20:34:41 Done.
+ if (extension->location() != Manifest::COMPONENT)
+ UpdateKeybindings(extension);
}
void CommandService::OnExtensionUninstalled(
@@ -310,6 +313,12 @@ void CommandService::OnExtensionUninstalled(
RemoveKeybindingPrefs(extension->id(), std::string());
}
+void CommandService::OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) {
+ if (extension->location() == Manifest::COMPONENT)
+ UpdateKeybindings(extension);
+}
+
void CommandService::UpdateKeybindingPrefs(const std::string& extension_id,
const std::string& command_name,
const std::string& keystroke) {

Powered by Google App Engine
This is Rietveld 408576698