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 #include "extensions/renderer/api_signature.h" | 5 #include "extensions/renderer/api_signature.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 SetCallback(value.As<v8::Function>()); | 214 SetCallback(value.As<v8::Function>()); |
215 return true; | 215 return true; |
216 } | 216 } |
217 | 217 |
218 } // namespace | 218 } // namespace |
219 | 219 |
220 APISignature::APISignature(const base::ListValue& specification) { | 220 APISignature::APISignature(const base::ListValue& specification) { |
221 signature_.reserve(specification.GetSize()); | 221 signature_.reserve(specification.GetSize()); |
222 for (const auto& value : specification) { | 222 for (const auto& value : specification) { |
223 const base::DictionaryValue* param = nullptr; | 223 const base::DictionaryValue* param = nullptr; |
224 CHECK(value->GetAsDictionary(¶m)); | 224 CHECK(value.GetAsDictionary(¶m)); |
225 signature_.push_back(base::MakeUnique<ArgumentSpec>(*param)); | 225 signature_.push_back(base::MakeUnique<ArgumentSpec>(*param)); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 APISignature::APISignature(std::vector<std::unique_ptr<ArgumentSpec>> signature) | 229 APISignature::APISignature(std::vector<std::unique_ptr<ArgumentSpec>> signature) |
230 : signature_(std::move(signature)) {} | 230 : signature_(std::move(signature)) {} |
231 | 231 |
232 APISignature::~APISignature() {} | 232 APISignature::~APISignature() {} |
233 | 233 |
234 bool APISignature::ParseArgumentsToV8( | 234 bool APISignature::ParseArgumentsToV8( |
(...skipping 25 matching lines...) Expand all Loading... |
260 BaseValueArgumentParser parser( | 260 BaseValueArgumentParser parser( |
261 context, signature_, arguments, type_refs, error, json.get()); | 261 context, signature_, arguments, type_refs, error, json.get()); |
262 if (!parser.ParseArguments()) | 262 if (!parser.ParseArguments()) |
263 return false; | 263 return false; |
264 *json_out = std::move(json); | 264 *json_out = std::move(json); |
265 *callback_out = parser.callback(); | 265 *callback_out = parser.callback(); |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
269 } // namespace extensions | 269 } // namespace extensions |
OLD | NEW |