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

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: 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
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 d38090c601d519129ca6b9b5fcc41512a4d67fd0..55c0be6f35e1e314871f044dfcc6003ccac3b46f 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -308,7 +308,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 OnExtensionLoaded.
+ if (extension->location() != Manifest::COMPONENT)
+ UpdateKeybindings(extension);
}
void CommandService::OnExtensionUninstalled(
@@ -318,6 +321,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) {
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.h ('k') | chrome/browser/extensions/extension_keybinding_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698