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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 SetCallback(value.As<v8::Function>()); | 227 SetCallback(value.As<v8::Function>()); |
228 return true; | 228 return true; |
229 } | 229 } |
230 | 230 |
231 } // namespace | 231 } // namespace |
232 | 232 |
233 APISignature::APISignature(const base::ListValue& specification) { | 233 APISignature::APISignature(const base::ListValue& specification) { |
234 signature_.reserve(specification.GetSize()); | 234 signature_.reserve(specification.GetSize()); |
235 for (const auto& value : specification) { | 235 for (const auto& value : specification) { |
236 const base::DictionaryValue* param = nullptr; | 236 const base::DictionaryValue* param = nullptr; |
237 CHECK(value.GetAsDictionary(¶m)); | 237 CHECK(value->GetAsDictionary(¶m)); |
238 signature_.push_back(base::MakeUnique<ArgumentSpec>(*param)); | 238 signature_.push_back(base::MakeUnique<ArgumentSpec>(*param)); |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 APISignature::APISignature(std::vector<std::unique_ptr<ArgumentSpec>> signature) | 242 APISignature::APISignature(std::vector<std::unique_ptr<ArgumentSpec>> signature) |
243 : signature_(std::move(signature)) {} | 243 : signature_(std::move(signature)) {} |
244 | 244 |
245 APISignature::~APISignature() {} | 245 APISignature::~APISignature() {} |
246 | 246 |
247 bool APISignature::ParseArgumentsToV8( | 247 bool APISignature::ParseArgumentsToV8( |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 return false; | 313 return false; |
314 json->Append(std::move(converted)); | 314 json->Append(std::move(converted)); |
315 } | 315 } |
316 | 316 |
317 *json_out = std::move(json); | 317 *json_out = std::move(json); |
318 *callback_out = callback; | 318 *callback_out = callback; |
319 return true; | 319 return true; |
320 } | 320 } |
321 | 321 |
322 } // namespace extensions | 322 } // namespace extensions |
OLD | NEW |