| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ | 5 #ifndef EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ |
| 6 #define EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ | 6 #define EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // |out_value|. Otherwise, no conversion is performed. | 53 // |out_value|. Otherwise, no conversion is performed. |
| 54 bool ParseArgument(v8::Local<v8::Context> context, | 54 bool ParseArgument(v8::Local<v8::Context> context, |
| 55 v8::Local<v8::Value> value, | 55 v8::Local<v8::Value> value, |
| 56 const RefMap& refs, | 56 const RefMap& refs, |
| 57 std::unique_ptr<base::Value>* out_value, | 57 std::unique_ptr<base::Value>* out_value, |
| 58 std::string* error) const; | 58 std::string* error) const; |
| 59 | 59 |
| 60 const std::string& name() const { return name_; } | 60 const std::string& name() const { return name_; } |
| 61 bool optional() const { return optional_; } | 61 bool optional() const { return optional_; } |
| 62 ArgumentType type() const { return type_; } | 62 ArgumentType type() const { return type_; } |
| 63 const std::set<std::string>& enum_values() const { return enum_values_; } |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 // Initializes this object according to |type_string| and |dict|. | 66 // Initializes this object according to |type_string| and |dict|. |
| 66 void InitializeType(const base::DictionaryValue* dict); | 67 void InitializeType(const base::DictionaryValue* dict); |
| 67 | 68 |
| 68 // Returns true if this argument refers to a fundamental type. | 69 // Returns true if this argument refers to a fundamental type. |
| 69 bool IsFundamentalType() const; | 70 bool IsFundamentalType() const; |
| 70 | 71 |
| 71 // Conversion functions. These should only be used if the spec is of the given | 72 // Conversion functions. These should only be used if the spec is of the given |
| 72 // type (otherwise, they will DCHECK). | 73 // type (otherwise, they will DCHECK). |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // The possible enum values, if defined for this argument. | 120 // The possible enum values, if defined for this argument. |
| 120 std::set<std::string> enum_values_; | 121 std::set<std::string> enum_values_; |
| 121 | 122 |
| 122 DISALLOW_COPY_AND_ASSIGN(ArgumentSpec); | 123 DISALLOW_COPY_AND_ASSIGN(ArgumentSpec); |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 } // namespace extensions | 126 } // namespace extensions |
| 126 | 127 |
| 127 #endif // EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ | 128 #endif // EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ |
| OLD | NEW |