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

Side by Side Diff: extensions/renderer/api_signature.cc

Issue 2805123002: [Extensions Bindings] Allow schema violations through sendRequest (Closed)
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « extensions/renderer/api_binding_js_util.cc ('k') | extensions/renderer/argument_spec.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
OLDNEW
« no previous file with comments | « extensions/renderer/api_binding_js_util.cc ('k') | extensions/renderer/argument_spec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698