| 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/api/commands/commands.h" | 5 #include "chrome/browser/extensions/api/commands/commands.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/commands/command_service.h" | 7 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (command_service->GetScriptBadgeCommand(extension_->id(), | 48 if (command_service->GetScriptBadgeCommand(extension_->id(), |
| 49 extensions::CommandService::ALL, | 49 extensions::CommandService::ALL, |
| 50 &script_badge, | 50 &script_badge, |
| 51 &active)) { | 51 &active)) { |
| 52 command_list->Append(CreateCommandValue(script_badge, active)); | 52 command_list->Append(CreateCommandValue(script_badge, active)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 extensions::CommandMap named_commands; | 55 extensions::CommandMap named_commands; |
| 56 command_service->GetNamedCommands(extension_->id(), | 56 command_service->GetNamedCommands(extension_->id(), |
| 57 extensions::CommandService::ALL, | 57 extensions::CommandService::ALL, |
| 58 extensions::CommandService::ANY_SCOPE, |
| 58 &named_commands); | 59 &named_commands); |
| 59 | 60 |
| 60 for (extensions::CommandMap::const_iterator iter = named_commands.begin(); | 61 for (extensions::CommandMap::const_iterator iter = named_commands.begin(); |
| 61 iter != named_commands.end(); ++iter) { | 62 iter != named_commands.end(); ++iter) { |
| 62 ui::Accelerator shortcut_assigned = | 63 ui::Accelerator shortcut_assigned = |
| 63 command_service->FindShortcutForCommand( | 64 command_service->FindShortcutForCommand( |
| 64 extension_->id(), iter->second.command_name()); | 65 extension_->id(), iter->second.command_name()); |
| 65 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); | 66 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); |
| 66 | 67 |
| 67 command_list->Append(CreateCommandValue(iter->second, active)); | 68 command_list->Append(CreateCommandValue(iter->second, active)); |
| 68 } | 69 } |
| 69 | 70 |
| 70 SetResult(command_list); | 71 SetResult(command_list); |
| 71 return true; | 72 return true; |
| 72 } | 73 } |
| OLD | NEW |