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

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

Issue 2617423003: [Extensions Bindings] Add support for updateArgumentsPostValidate (Closed)
Patch Set: rebase Created 3 years, 11 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 | « no previous file | extensions/renderer/api_binding_hooks.h » ('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_binding.h" 5 #include "extensions/renderer/api_binding.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 std::vector<v8::Local<v8::Value>> argument_list; 254 std::vector<v8::Local<v8::Value>> argument_list;
255 if (arguments->Length() > 0) { 255 if (arguments->Length() > 0) {
256 // Just copying handles should never fail. 256 // Just copying handles should never fail.
257 CHECK(arguments->GetRemaining(&argument_list)); 257 CHECK(arguments->GetRemaining(&argument_list));
258 } 258 }
259 259
260 bool invalid_invocation = false; 260 bool invalid_invocation = false;
261 { 261 {
262 v8::TryCatch try_catch(isolate); 262 v8::TryCatch try_catch(isolate);
263 APIBindingHooks::RequestResult hooks_result = 263 APIBindingHooks::RequestResult hooks_result =
264 binding_hooks_->HandleRequest(api_name_, name, context, 264 binding_hooks_->RunHooks(api_name_, name, context,
265 signature, &argument_list, *type_refs_); 265 signature, &argument_list, *type_refs_);
266 266
267 switch (hooks_result.code) { 267 switch (hooks_result.code) {
268 case APIBindingHooks::RequestResult::INVALID_INVOCATION: 268 case APIBindingHooks::RequestResult::INVALID_INVOCATION:
269 invalid_invocation = true; 269 invalid_invocation = true;
270 // Throw a type error below so that it's not caught by our try-catch. 270 // Throw a type error below so that it's not caught by our try-catch.
271 break; 271 break;
272 case APIBindingHooks::RequestResult::THROWN: 272 case APIBindingHooks::RequestResult::THROWN:
273 DCHECK(try_catch.HasCaught()); 273 DCHECK(try_catch.HasCaught());
274 try_catch.ReThrow(); 274 try_catch.ReThrow();
275 return; 275 return;
(...skipping 28 matching lines...) Expand all
304 arguments->ThrowTypeError("Invalid invocation"); 304 arguments->ThrowTypeError("Invalid invocation");
305 return; 305 return;
306 } 306 }
307 307
308 DCHECK(converted_arguments); 308 DCHECK(converted_arguments);
309 method_callback_.Run(name, std::move(converted_arguments), isolate, context, 309 method_callback_.Run(name, std::move(converted_arguments), isolate, context,
310 callback); 310 callback);
311 } 311 }
312 312
313 } // namespace extensions 313 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/api_binding_hooks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698