| 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/ui/views/extensions/extension_keybinding_registry_views
.h" | 5 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/commands/extension_command_service.h" | 7 #include "chrome/browser/extensions/api/commands/extension_command_service.h" |
| 8 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" | 8 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" |
| 9 #include "chrome/browser/extensions/extension_browser_event_router.h" | 9 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 for (iter = event_targets_.begin(); iter != event_targets_.end(); ++iter) | 25 for (iter = event_targets_.begin(); iter != event_targets_.end(); ++iter) |
| 26 focus_manager_->UnregisterAccelerator(iter->first, this); | 26 focus_manager_->UnregisterAccelerator(iter->first, this); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void ExtensionKeybindingRegistryViews::AddExtensionKeybinding( | 29 void ExtensionKeybindingRegistryViews::AddExtensionKeybinding( |
| 30 const Extension* extension) { | 30 const Extension* extension) { |
| 31 ExtensionCommandService* command_service = | 31 ExtensionCommandService* command_service = |
| 32 ExtensionCommandServiceFactory::GetForProfile(profile_); | 32 ExtensionCommandServiceFactory::GetForProfile(profile_); |
| 33 // Add all the active keybindings (except page actions and browser actions, | 33 // Add all the active keybindings (except page actions and browser actions, |
| 34 // which are handled elsewhere). | 34 // which are handled elsewhere). |
| 35 const Extension::CommandMap& commands = | 35 const extensions::CommandMap& commands = |
| 36 command_service->GetActiveNamedCommands(extension->id()); | 36 command_service->GetActiveNamedCommands(extension->id()); |
| 37 Extension::CommandMap::const_iterator iter = commands.begin(); | 37 extensions::CommandMap::const_iterator iter = commands.begin(); |
| 38 for (; iter != commands.end(); ++iter) { | 38 for (; iter != commands.end(); ++iter) { |
| 39 event_targets_[iter->second.accelerator()] = | 39 event_targets_[iter->second.accelerator()] = |
| 40 std::make_pair(extension->id(), iter->second.command_name()); | 40 std::make_pair(extension->id(), iter->second.command_name()); |
| 41 focus_manager_->RegisterAccelerator( | 41 focus_manager_->RegisterAccelerator( |
| 42 iter->second.accelerator(), | 42 iter->second.accelerator(), |
| 43 ui::AcceleratorManager::kHighPriority, this); | 43 ui::AcceleratorManager::kHighPriority, this); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ExtensionKeybindingRegistryViews::RemoveExtensionKeybinding( | 47 void ExtensionKeybindingRegistryViews::RemoveExtensionKeybinding( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 | 72 |
| 73 service->browser_event_router()->CommandExecuted( | 73 service->browser_event_router()->CommandExecuted( |
| 74 profile_, it->second.first, it->second.second); | 74 profile_, it->second.first, it->second.second); |
| 75 | 75 |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { | 79 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| OLD | NEW |