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/command_service.h" | 7 #include "chrome/browser/extensions/api/commands/command_service.h" |
8 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 8 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // This object only handles named commands, not browser/page actions. | 40 // This object only handles named commands, not browser/page actions. |
41 if (ShouldIgnoreCommand(command_name)) | 41 if (ShouldIgnoreCommand(command_name)) |
42 return; | 42 return; |
43 | 43 |
44 extensions::CommandService* command_service = | 44 extensions::CommandService* command_service = |
45 extensions::CommandService::Get(profile_); | 45 extensions::CommandService::Get(profile_); |
46 // Add all the active keybindings (except page actions and browser actions, | 46 // Add all the active keybindings (except page actions and browser actions, |
47 // which are handled elsewhere). | 47 // which are handled elsewhere). |
48 extensions::CommandMap commands; | 48 extensions::CommandMap commands; |
49 if (!command_service->GetNamedCommands( | 49 if (!command_service->GetNamedCommands( |
50 extension->id(), extensions::CommandService::ACTIVE_ONLY, &commands)) | 50 extension->id(), |
| 51 extensions::CommandService::ACTIVE_ONLY, |
| 52 extensions::CommandService::REGULAR, |
| 53 &commands)) |
51 return; | 54 return; |
52 extensions::CommandMap::const_iterator iter = commands.begin(); | 55 extensions::CommandMap::const_iterator iter = commands.begin(); |
53 for (; iter != commands.end(); ++iter) { | 56 for (; iter != commands.end(); ++iter) { |
54 if (!command_name.empty() && (iter->second.command_name() != command_name)) | 57 if (!command_name.empty() && (iter->second.command_name() != command_name)) |
55 continue; | 58 continue; |
56 | 59 |
57 event_targets_[iter->second.accelerator()] = | 60 event_targets_[iter->second.accelerator()] = |
58 std::make_pair(extension->id(), iter->second.command_name()); | 61 std::make_pair(extension->id(), iter->second.command_name()); |
59 focus_manager_->RegisterAccelerator( | 62 focus_manager_->RegisterAccelerator( |
60 iter->second.accelerator(), | 63 iter->second.accelerator(), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 96 } |
94 | 97 |
95 CommandExecuted(it->second.first, it->second.second); | 98 CommandExecuted(it->second.first, it->second.second); |
96 | 99 |
97 return true; | 100 return true; |
98 } | 101 } |
99 | 102 |
100 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { | 103 bool ExtensionKeybindingRegistryViews::CanHandleAccelerators() const { |
101 return true; | 104 return true; |
102 } | 105 } |
OLD | NEW |