| 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 #ifndef CHROME_COMMON_EXTENSIONS_COMMAND_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_COMMAND_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_COMMAND_H_ | 6 #define CHROME_COMMON_EXTENSIONS_COMMAND_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 ~Command(); | 30 ~Command(); |
| 31 | 31 |
| 32 // The platform value for the Command. | 32 // The platform value for the Command. |
| 33 static std::string CommandPlatform(); | 33 static std::string CommandPlatform(); |
| 34 | 34 |
| 35 // Parse a string as an accelerator. If the accelerator is unparsable then | 35 // Parse a string as an accelerator. If the accelerator is unparsable then |
| 36 // a generic ui::Accelerator object will be returns (with key_code Unknown). | 36 // a generic ui::Accelerator object will be returns (with key_code Unknown). |
| 37 static ui::Accelerator StringToAccelerator(const std::string& accelerator); | 37 static ui::Accelerator StringToAccelerator(const std::string& accelerator); |
| 38 | 38 |
| 39 // Parse the command. | 39 // Parse the command. |
| 40 bool Parse(base::DictionaryValue* command, | 40 bool Parse(const base::DictionaryValue* command, |
| 41 const std::string& command_name, | 41 const std::string& command_name, |
| 42 int index, | 42 int index, |
| 43 string16* error); | 43 string16* error); |
| 44 | 44 |
| 45 // Convert a Command object from |extension| to a DictionaryValue. | 45 // Convert a Command object from |extension| to a DictionaryValue. |
| 46 // |active| specifies whether the command is active or not. | 46 // |active| specifies whether the command is active or not. |
| 47 base::DictionaryValue* ToValue( | 47 base::DictionaryValue* ToValue( |
| 48 const Extension* extension, bool active) const; | 48 const Extension* extension, bool active) const; |
| 49 | 49 |
| 50 // Accessors: | 50 // Accessors: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 ui::Accelerator accelerator_; | 62 ui::Accelerator accelerator_; |
| 63 string16 description_; | 63 string16 description_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // A mapping of command name (std::string) to a command object. | 66 // A mapping of command name (std::string) to a command object. |
| 67 typedef std::map<std::string, Command> CommandMap; | 67 typedef std::map<std::string, Command> CommandMap; |
| 68 | 68 |
| 69 } // namespace extensions | 69 } // namespace extensions |
| 70 | 70 |
| 71 #endif // CHROME_COMMON_EXTENSIONS_COMMAND_H_ | 71 #endif // CHROME_COMMON_EXTENSIONS_COMMAND_H_ |
| OLD | NEW |