| 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 #include "chrome/browser/profiles/profile.h" |
| 8 | 9 |
| 9 namespace { | 10 namespace { |
| 10 | 11 |
| 11 base::DictionaryValue* CreateCommandValue( | 12 base::DictionaryValue* CreateCommandValue( |
| 12 const extensions::Command& command, bool active) { | 13 const extensions::Command& command, bool active) { |
| 13 base::DictionaryValue* result = new base::DictionaryValue(); | 14 base::DictionaryValue* result = new base::DictionaryValue(); |
| 14 result->SetString("name", command.command_name()); | 15 result->SetString("name", command.command_name()); |
| 15 result->SetString("description", command.description()); | 16 result->SetString("description", command.description()); |
| 16 result->SetString("shortcut", | 17 result->SetString("shortcut", |
| 17 active ? command.accelerator().GetShortcutText() : | 18 active ? command.accelerator().GetShortcutText() : |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 extension_->id(), iter->second.command_name()); | 57 extension_->id(), iter->second.command_name()); |
| 57 ui::Accelerator shortcut_assigned = command.accelerator(); | 58 ui::Accelerator shortcut_assigned = command.accelerator(); |
| 58 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); | 59 active = (shortcut_assigned.key_code() != ui::VKEY_UNKNOWN); |
| 59 | 60 |
| 60 command_list->Append(CreateCommandValue(iter->second, active)); | 61 command_list->Append(CreateCommandValue(iter->second, active)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 SetResult(command_list); | 64 SetResult(command_list); |
| 64 return true; | 65 return true; |
| 65 } | 66 } |
| OLD | NEW |