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

Unified Diff: chrome/browser/extensions/api/commands/command_service.cc

Issue 904943003: Fixes component extension commands assignment on reload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move clearing to OnExtensionUninstalled Created 5 years, 10 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 55c0be6f35e1e314871f044dfcc6003ccac3b46f..158d48f9fb589531389182945ac707e92e041bfe 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -805,14 +805,24 @@ void CommandService::RemoveKeybindingPrefs(const std::string& extension_id,
if (extension == extension_id) {
// If |command_name| is specified, delete only that command. Otherwise,
// delete all commands.
- if (!command_name.empty()) {
std::string command;
Mike Wittman 2015/02/13 22:11:20 indentation (+ next three lines)
item->GetString(kCommandName, &command);
- if (command_name != command)
+ if (!command_name.empty() && command_name != command)
continue;
- }
keys_to_remove.push_back(it.key());
+
+ // Only clear the was_assigned pref if we clear all commands.
+ if (!command_name.empty())
+ continue;
+
+ scoped_ptr<base::DictionaryValue> command_keys(new base::DictionaryValue);
+ command_keys->SetBoolean(kSuggestedKeyWasAssigned, false);
Mike Wittman 2015/02/13 22:11:20 I'd prefer to remove this key from the preferences
+ scoped_ptr<base::DictionaryValue> suggested_key_prefs(
+ new base::DictionaryValue);
+ suggested_key_prefs->Set(command, command_keys.release());
+ MergeSuggestedKeyPrefs(extension_id, ExtensionPrefs::Get(profile_),
+ suggested_key_prefs.Pass());
}
}

Powered by Google App Engine
This is Rietveld 408576698