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

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

Issue 2575173002: [Extensions Bindings] Add a bridge to use current custom bindings (Closed)
Patch Set: . Created 4 years 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
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 DCHECK(success.IsJust()); 289 DCHECK(success.IsJust());
290 DCHECK(success.FromJust()); 290 DCHECK(success.FromJust());
291 } 291 }
292 292
293 if (binding_hooks_) 293 if (binding_hooks_)
294 binding_hooks_->InitializeInContext(context, api_name_); 294 binding_hooks_->InitializeInContext(context, api_name_);
295 295
296 return object; 296 return object;
297 } 297 }
298 298
299 v8::Local<v8::Object> APIBinding::GetJSHooksInterface(
jbroman 2016/12/16 19:00:49 nit: spelling changes from "Hook" to "Hooks"; why?
Devlin 2016/12/16 20:31:17 Accident; synchronized.
300 v8::Local<v8::Context> context) {
301 return binding_hooks_->GetJSHookInterface(api_name_, context);
302 }
303
299 void APIBinding::HandleCall(const std::string& name, 304 void APIBinding::HandleCall(const std::string& name,
300 const binding::APISignature* signature, 305 const binding::APISignature* signature,
301 gin::Arguments* arguments) { 306 gin::Arguments* arguments) {
302 std::string error; 307 std::string error;
303 v8::Isolate* isolate = arguments->isolate(); 308 v8::Isolate* isolate = arguments->isolate();
304 v8::HandleScope handle_scope(isolate); 309 v8::HandleScope handle_scope(isolate);
305 310
306 // Since this is called synchronously from the JS entry point, 311 // Since this is called synchronously from the JS entry point,
307 // GetCurrentContext() should always be correct. 312 // GetCurrentContext() should always be correct.
308 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 313 v8::Local<v8::Context> context = isolate->GetCurrentContext();
(...skipping 20 matching lines...) Expand all
329 if (!parsed_arguments) { 334 if (!parsed_arguments) {
330 arguments->ThrowTypeError("Invalid invocation"); 335 arguments->ThrowTypeError("Invalid invocation");
331 return; 336 return;
332 } 337 }
333 338
334 method_callback_.Run(name, std::move(parsed_arguments), isolate, 339 method_callback_.Run(name, std::move(parsed_arguments), isolate,
335 context, callback); 340 context, callback);
336 } 341 }
337 342
338 } // namespace extensions 343 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698