Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: extensions/renderer/argument_spec.h

Issue 2837023003: [Extensions Bindings] Add argument parsing errors (Closed)
Patch Set: nits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 bool ParseArgumentToArray(v8::Local<v8::Context> context, 106 bool ParseArgumentToArray(v8::Local<v8::Context> context,
107 v8::Local<v8::Array> value, 107 v8::Local<v8::Array> value,
108 const APITypeReferenceMap& refs, 108 const APITypeReferenceMap& refs,
109 std::unique_ptr<base::Value>* out_value, 109 std::unique_ptr<base::Value>* out_value,
110 std::string* error) const; 110 std::string* error) const;
111 bool ParseArgumentToAny(v8::Local<v8::Context> context, 111 bool ParseArgumentToAny(v8::Local<v8::Context> context,
112 v8::Local<v8::Value> value, 112 v8::Local<v8::Value> value,
113 std::unique_ptr<base::Value>* out_value, 113 std::unique_ptr<base::Value>* out_value,
114 std::string* error) const; 114 std::string* error) const;
115 115
116 // Returns an error message indicating the type of |value| does not match the
117 // expected type.
118 std::string GetInvalidTypeError(v8::Local<v8::Value> value) const;
119
116 // The name of the argument. 120 // The name of the argument.
117 std::string name_; 121 std::string name_;
118 122
119 // The type of the argument. 123 // The type of the argument.
120 ArgumentType type_; 124 ArgumentType type_;
121 125
122 // Whether or not the argument is required. 126 // Whether or not the argument is required.
123 bool optional_; 127 bool optional_;
124 128
125 // The reference the argument points to, if any. Note that if this is set, 129 // The reference the argument points to, if any. Note that if this is set,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // to allow the API to pass an object with arbitrary properties. Only 163 // to allow the API to pass an object with arbitrary properties. Only
160 // applicable for ArgumentType::OBJECT. 164 // applicable for ArgumentType::OBJECT.
161 std::unique_ptr<ArgumentSpec> additional_properties_; 165 std::unique_ptr<ArgumentSpec> additional_properties_;
162 166
163 DISALLOW_COPY_AND_ASSIGN(ArgumentSpec); 167 DISALLOW_COPY_AND_ASSIGN(ArgumentSpec);
164 }; 168 };
165 169
166 } // namespace extensions 170 } // namespace extensions
167 171
168 #endif // EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_ 172 #endif // EXTENSIONS_RENDERER_ARGUMENT_SPEC_H_
OLDNEW
« no previous file with comments | « extensions/renderer/api_invocation_errors_unittest.cc ('k') | extensions/renderer/argument_spec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698