Chromium Code Reviews| 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()); |
| } |
| } |