| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_COMMANDS_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_COMMANDS_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include <map> |
| 11 |
| 12 #include "base/string16.h" |
| 13 #include "ui/base/accelerators/accelerator.h" |
| 14 |
| 15 namespace base { |
| 16 class DictionaryValue; |
| 17 } |
| 18 |
| 19 namespace extensions { |
| 20 |
| 21 class Command { |
| 22 public: |
| 23 // Define out of line constructor/destructor to please Clang. |
| 24 Command(); |
| 25 ~Command(); |
| 26 |
| 27 // The platform value for the Command. |
| 28 static std::string CommandPlatform(); |
| 29 |
| 30 // Parse the command. |
| 31 bool Parse(base::DictionaryValue* command, |
| 32 const std::string& command_name, |
| 33 int index, |
| 34 string16* error); |
| 35 |
| 36 // Accessors: |
| 37 const std::string& command_name() const { return command_name_; } |
| 38 const ui::Accelerator& accelerator() const { return accelerator_; } |
| 39 const std::string& description() const { return description_; } |
| 40 |
| 41 private: |
| 42 ui::Accelerator ParseImpl(const std::string& shortcut, |
| 43 const std::string& platform_key, |
| 44 int index, |
| 45 string16* error); |
| 46 std::string command_name_; |
| 47 ui::Accelerator accelerator_; |
| 48 std::string description_; |
| 49 }; |
| 50 |
| 51 // A mapping of command name (std::string) to a command object. |
| 52 typedef std::map<std::string, Command> CommandMap; |
| 53 |
| 54 } |
| 55 |
| 56 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_COMMANDS_H_ |
| OLD | NEW |