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/webui/extensions/command_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/command_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/api/commands/command_service.h" | 10 #include "chrome/browser/extensions/api/commands/command_service.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (command_service->GetScriptBadgeCommand((*extension)->id(), | 142 if (command_service->GetScriptBadgeCommand((*extension)->id(), |
143 CommandService::ALL, | 143 CommandService::ALL, |
144 &script_badge, | 144 &script_badge, |
145 &active)) { | 145 &active)) { |
146 extensions_list->Append(script_badge.ToValue((extension->get()), active)); | 146 extensions_list->Append(script_badge.ToValue((extension->get()), active)); |
147 } | 147 } |
148 | 148 |
149 extensions::CommandMap named_commands; | 149 extensions::CommandMap named_commands; |
150 if (command_service->GetNamedCommands((*extension)->id(), | 150 if (command_service->GetNamedCommands((*extension)->id(), |
151 CommandService::ALL, | 151 CommandService::ALL, |
| 152 extensions::CommandService::ANY_SCOPE, |
152 &named_commands)) { | 153 &named_commands)) { |
153 for (extensions::CommandMap::const_iterator iter = named_commands.begin(); | 154 for (extensions::CommandMap::const_iterator iter = named_commands.begin(); |
154 iter != named_commands.end(); ++iter) { | 155 iter != named_commands.end(); ++iter) { |
155 ui::Accelerator shortcut_assigned = | 156 ui::Accelerator shortcut_assigned = |
156 command_service->FindShortcutForCommand( | 157 command_service->FindShortcutForCommand( |
157 (*extension)->id(), iter->second.command_name()); | 158 (*extension)->id(), iter->second.command_name()); |
158 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); | 159 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); |
159 | 160 |
160 extensions_list->Append( | 161 extensions_list->Append( |
161 iter->second.ToValue((extension->get()), active)); | 162 iter->second.ToValue((extension->get()), active)); |
162 } | 163 } |
163 } | 164 } |
164 | 165 |
165 if (!extensions_list->empty()) { | 166 if (!extensions_list->empty()) { |
166 extension_dict->Set("commands", extensions_list.release()); | 167 extension_dict->Set("commands", extensions_list.release()); |
167 results->Append(extension_dict.release()); | 168 results->Append(extension_dict.release()); |
168 } | 169 } |
169 } | 170 } |
170 | 171 |
171 commands->Set("commands", results); | 172 commands->Set("commands", results); |
172 } | 173 } |
173 | 174 |
174 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |