| 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/common/extensions/command.h" | 5 #include "chrome/common/extensions/command.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // http://blogs.msdn.com/b/oldnewthing/archive/2004/03/29/101121.aspx. | 90 // http://blogs.msdn.com/b/oldnewthing/archive/2004/03/29/101121.aspx. |
| 91 if (key == ui::VKEY_UNKNOWN || (ctrl && alt)) { | 91 if (key == ui::VKEY_UNKNOWN || (ctrl && alt)) { |
| 92 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 92 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 93 errors::kInvalidKeyBinding, | 93 errors::kInvalidKeyBinding, |
| 94 base::IntToString(index), | 94 base::IntToString(index), |
| 95 platform_key, | 95 platform_key, |
| 96 shortcut); | 96 shortcut); |
| 97 return ui::Accelerator(); | 97 return ui::Accelerator(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 return ui::Accelerator(key, modifiers); | 100 return ui::Accelerator(key, modifiers, ui::ET_KEY_PRESSED); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // static | 103 // static |
| 104 std::string Command::CommandPlatform() { | 104 std::string Command::CommandPlatform() { |
| 105 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
| 106 return values::kKeybindingPlatformWin; | 106 return values::kKeybindingPlatformWin; |
| 107 #elif defined(OS_MACOSX) | 107 #elif defined(OS_MACOSX) |
| 108 return values::kKeybindingPlatformMac; | 108 return values::kKeybindingPlatformMac; |
| 109 #elif defined(OS_CHROMEOS) | 109 #elif defined(OS_CHROMEOS) |
| 110 return values::kKeybindingPlatformChromeOs; | 110 return values::kKeybindingPlatformChromeOs; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 command_description = description(); | 229 command_description = description(); |
| 230 } | 230 } |
| 231 extension_data->SetString("description", command_description); | 231 extension_data->SetString("description", command_description); |
| 232 extension_data->SetBoolean("active", active); | 232 extension_data->SetBoolean("active", active); |
| 233 extension_data->SetString("keybinding", accelerator().GetShortcutText()); | 233 extension_data->SetString("keybinding", accelerator().GetShortcutText()); |
| 234 | 234 |
| 235 return extension_data; | 235 return extension_data; |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace extensions | 238 } // namespace extensions |
| OLD | NEW |