| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 CHECK(!arguments.empty()); | 298 CHECK(!arguments.empty()); |
| 299 if (arguments[size - 1]->IsFunction()) { | 299 if (arguments[size - 1]->IsFunction()) { |
| 300 callback = arguments[size - 1].As<v8::Function>(); | 300 callback = arguments[size - 1].As<v8::Function>(); |
| 301 --size; | 301 --size; |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 auto json = base::MakeUnique<base::ListValue>(); | 305 auto json = base::MakeUnique<base::ListValue>(); |
| 306 std::unique_ptr<content::V8ValueConverter> converter( | 306 std::unique_ptr<content::V8ValueConverter> converter( |
| 307 content::V8ValueConverter::create()); | 307 content::V8ValueConverter::create()); |
| 308 converter->SetFunctionAllowed(true); |
| 308 for (size_t i = 0; i < size; ++i) { | 309 for (size_t i = 0; i < size; ++i) { |
| 309 std::unique_ptr<base::Value> converted = | 310 std::unique_ptr<base::Value> converted = |
| 310 converter->FromV8Value(arguments[i], context); | 311 converter->FromV8Value(arguments[i], context); |
| 311 if (!converted) | 312 if (!converted) |
| 312 return false; | 313 return false; |
| 313 json->Append(std::move(converted)); | 314 json->Append(std::move(converted)); |
| 314 } | 315 } |
| 315 | 316 |
| 316 *json_out = std::move(json); | 317 *json_out = std::move(json); |
| 317 *callback_out = callback; | 318 *callback_out = callback; |
| 318 return true; | 319 return true; |
| 319 } | 320 } |
| 320 | 321 |
| 321 } // namespace extensions | 322 } // namespace extensions |
| OLD | NEW |