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

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: Condition on Manifest::COMPONENT. Created 6 years 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..47b070c03a467d3ace0bdcf71dba424785667307 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -300,14 +300,30 @@ void CommandService::OnExtensionWillBeInstalled(
bool is_update,
bool from_ephemeral,
const std::string& old_name) {
- UpdateKeybindings(extension);
+ if (extension->location() != Manifest::COMPONENT)
Finnur 2014/12/11 13:51:49 I would document this with: // Component extensio
David Tseng 2014/12/12 18:38:31 As mentioned before, I was seeing component extens
Finnur 2014/12/15 14:01:42 OK, in that case I'd remove the if-check from OnEx
Finnur 2014/12/19 15:26:52 What about this?
David Tseng 2014/12/19 19:41:00 Done.
+ UpdateKeybindings(extension);
}
void CommandService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
const Extension* extension,
extensions::UninstallReason reason) {
- RemoveKeybindingPrefs(extension->id(), std::string());
+ if (extension->location() != Manifest::COMPONENT)
+ RemoveKeybindingPrefs(extension->id(), std::string());
+}
+
+void CommandService::OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) {
+ if (extension->location() == Manifest::COMPONENT)
+ UpdateKeybindings(extension);
+}
+
+void CommandService::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ if (extension->location() == Manifest::COMPONENT)
+ RemoveKeybindingPrefs(extension->id(), std::string());
Finnur 2014/12/11 13:51:49 Do we even want to remove keybindings for componen
David Tseng 2014/12/12 18:38:31 Removed this method.
}
void CommandService::UpdateKeybindingPrefs(const std::string& extension_id,
« no previous file with comments | « chrome/browser/extensions/api/commands/command_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698