| 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 "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 8 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
| 9 #include "chrome/browser/extensions/event_router.h" | 9 #include "chrome/browser/extensions/event_router.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 void ExtensionKeybindingRegistry::Init() { | 37 void ExtensionKeybindingRegistry::Init() { |
| 38 ExtensionService* service = | 38 ExtensionService* service = |
| 39 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 39 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 40 if (!service) | 40 if (!service) |
| 41 return; // ExtensionService can be null during testing. | 41 return; // ExtensionService can be null during testing. |
| 42 | 42 |
| 43 const ExtensionSet* extensions = service->extensions(); | 43 const ExtensionSet* extensions = service->extensions(); |
| 44 ExtensionSet::const_iterator iter = extensions->begin(); | 44 ExtensionSet::const_iterator iter = extensions->begin(); |
| 45 for (; iter != extensions->end(); ++iter) | 45 for (; iter != extensions->end(); ++iter) |
| 46 if (ExtensionMatchesFilter(*iter)) | 46 if (ExtensionMatchesFilter(iter->get())) |
| 47 AddExtensionKeybinding(*iter, std::string()); | 47 AddExtensionKeybinding(iter->get(), std::string()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool ExtensionKeybindingRegistry::ShouldIgnoreCommand( | 50 bool ExtensionKeybindingRegistry::ShouldIgnoreCommand( |
| 51 const std::string& command) const { | 51 const std::string& command) const { |
| 52 return command == extension_manifest_values::kPageActionCommandEvent || | 52 return command == extension_manifest_values::kPageActionCommandEvent || |
| 53 command == extension_manifest_values::kBrowserActionCommandEvent || | 53 command == extension_manifest_values::kBrowserActionCommandEvent || |
| 54 command == extension_manifest_values::kScriptBadgeCommandEvent; | 54 command == extension_manifest_values::kScriptBadgeCommandEvent; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ExtensionKeybindingRegistry::CommandExecuted( | 57 void ExtensionKeybindingRegistry::CommandExecuted( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return true; | 135 return true; |
| 136 case PLATFORM_APPS_ONLY: | 136 case PLATFORM_APPS_ONLY: |
| 137 return extension->is_platform_app(); | 137 return extension->is_platform_app(); |
| 138 default: | 138 default: |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 } | 140 } |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace extensions | 144 } // namespace extensions |
| OLD | NEW |