| 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/extension_keybinding_registry.h" | 5 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 return; // ExtensionService can be null during testing. | 34 return; // ExtensionService can be null during testing. |
| 35 | 35 |
| 36 const ExtensionSet* extensions = service->extensions(); | 36 const ExtensionSet* extensions = service->extensions(); |
| 37 ExtensionSet::const_iterator iter = extensions->begin(); | 37 ExtensionSet::const_iterator iter = extensions->begin(); |
| 38 for (; iter != extensions->end(); ++iter) | 38 for (; iter != extensions->end(); ++iter) |
| 39 AddExtensionKeybinding(*iter, std::string()); | 39 AddExtensionKeybinding(*iter, std::string()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool ExtensionKeybindingRegistry::ShouldIgnoreCommand( | 42 bool ExtensionKeybindingRegistry::ShouldIgnoreCommand( |
| 43 const std::string& command) const { | 43 const std::string& command) const { |
| 44 return command == extension_manifest_values::kPageActionKeybindingEvent || | 44 return command == extension_manifest_values::kPageActionCommandEvent || |
| 45 command == extension_manifest_values::kBrowserActionKeybindingEvent; | 45 command == extension_manifest_values::kBrowserActionCommandEvent || |
| 46 command == extension_manifest_values::kScriptBadgeCommandEvent; |
| 46 } | 47 } |
| 47 | 48 |
| 48 void ExtensionKeybindingRegistry::Observe( | 49 void ExtensionKeybindingRegistry::Observe( |
| 49 int type, | 50 int type, |
| 50 const content::NotificationSource& source, | 51 const content::NotificationSource& source, |
| 51 const content::NotificationDetails& details) { | 52 const content::NotificationDetails& details) { |
| 52 switch (type) { | 53 switch (type) { |
| 53 case chrome::NOTIFICATION_EXTENSION_LOADED: | 54 case chrome::NOTIFICATION_EXTENSION_LOADED: |
| 54 AddExtensionKeybinding( | 55 AddExtensionKeybinding( |
| 55 content::Details<const extensions::Extension>(details).ptr(), | 56 content::Details<const extensions::Extension>(details).ptr(), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 RemoveExtensionKeybinding(extension, payload->second); | 81 RemoveExtensionKeybinding(extension, payload->second); |
| 81 break; | 82 break; |
| 82 } | 83 } |
| 83 default: | 84 default: |
| 84 NOTREACHED(); | 85 NOTREACHED(); |
| 85 break; | 86 break; |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace extensions | 90 } // namespace extensions |
| OLD | NEW |