OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/commands/command_service.h" | 5 #include "chrome/browser/extensions/api/commands/command_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 content::BrowserContext* browser_context, | 298 content::BrowserContext* browser_context, |
299 const Extension* extension, | 299 const Extension* extension, |
300 bool is_update, | 300 bool is_update, |
301 bool from_ephemeral, | 301 bool from_ephemeral, |
302 const std::string& old_name) { | 302 const std::string& old_name) { |
303 UpdateKeybindings(extension); | 303 UpdateKeybindings(extension); |
304 } | 304 } |
305 | 305 |
306 void CommandService::OnExtensionUninstalled( | 306 void CommandService::OnExtensionUninstalled( |
307 content::BrowserContext* browser_context, | 307 content::BrowserContext* browser_context, |
308 const Extension* extension) { | 308 const Extension* extension, |
| 309 extensions::UninstallReason reason) { |
309 RemoveKeybindingPrefs(extension->id(), std::string()); | 310 RemoveKeybindingPrefs(extension->id(), std::string()); |
310 } | 311 } |
311 | 312 |
312 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, | 313 void CommandService::UpdateKeybindingPrefs(const std::string& extension_id, |
313 const std::string& command_name, | 314 const std::string& command_name, |
314 const std::string& keystroke) { | 315 const std::string& keystroke) { |
315 Command command = FindCommandByName(extension_id, command_name); | 316 Command command = FindCommandByName(extension_id, command_name); |
316 | 317 |
317 // The extension command might be assigned another shortcut. Remove that | 318 // The extension command might be assigned another shortcut. Remove that |
318 // shortcut before proceeding. | 319 // shortcut before proceeding. |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 return true; | 859 return true; |
859 } | 860 } |
860 | 861 |
861 template <> | 862 template <> |
862 void | 863 void |
863 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { | 864 BrowserContextKeyedAPIFactory<CommandService>::DeclareFactoryDependencies() { |
864 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); | 865 DependsOn(ExtensionCommandsGlobalRegistry::GetFactoryInstance()); |
865 } | 866 } |
866 | 867 |
867 } // namespace extensions | 868 } // namespace extensions |
OLD | NEW |