| 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() {} | 229 APISignature::~APISignature() {} |
| 230 | 230 |
| 231 bool APISignature::ParseArgumentsToV8( | 231 bool APISignature::ParseArgumentsToV8( |
| 232 v8::Local<v8::Context> context, | 232 v8::Local<v8::Context> context, |
| 233 const std::vector<v8::Local<v8::Value>>& arguments, | 233 const std::vector<v8::Local<v8::Value>>& arguments, |
| 234 const APITypeReferenceMap& type_refs, | 234 const APITypeReferenceMap& type_refs, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 257 BaseValueArgumentParser parser( | 257 BaseValueArgumentParser parser( |
| 258 context, signature_, arguments, type_refs, error, json.get()); | 258 context, signature_, arguments, type_refs, error, json.get()); |
| 259 if (!parser.ParseArguments()) | 259 if (!parser.ParseArguments()) |
| 260 return false; | 260 return false; |
| 261 *json_out = std::move(json); | 261 *json_out = std::move(json); |
| 262 *callback_out = parser.callback(); | 262 *callback_out = parser.callback(); |
| 263 return true; | 263 return true; |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace extensions | 266 } // namespace extensions |
| OLD | NEW |