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/native_extension_bindings_system.h" | 5 #include "extensions/renderer/native_extension_bindings_system.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 588 |
589 v8::Maybe<bool> success = | 589 v8::Maybe<bool> success = |
590 internal_apis->CreateDataProperty(context, v8_name, api_binding); | 590 internal_apis->CreateDataProperty(context, v8_name, api_binding); |
591 if (!success.IsJust() || !success.FromJust()) | 591 if (!success.IsJust() || !success.FromJust()) |
592 return; | 592 return; |
593 | 593 |
594 info.GetReturnValue().Set(api_binding); | 594 info.GetReturnValue().Set(api_binding); |
595 } | 595 } |
596 | 596 |
597 void NativeExtensionBindingsSystem::SendRequest( | 597 void NativeExtensionBindingsSystem::SendRequest( |
598 std::unique_ptr<APIBinding::Request> request, | 598 std::unique_ptr<APIRequestHandler::Request> request, |
599 v8::Local<v8::Context> context) { | 599 v8::Local<v8::Context> context) { |
600 ScriptContext* script_context = | 600 ScriptContext* script_context = |
601 ScriptContextSet::GetContextByV8Context(context); | 601 ScriptContextSet::GetContextByV8Context(context); |
602 | 602 |
603 GURL url; | 603 GURL url; |
604 blink::WebLocalFrame* frame = script_context->web_frame(); | 604 blink::WebLocalFrame* frame = script_context->web_frame(); |
605 if (frame && !frame->document().isNull()) | 605 if (frame && !frame->document().isNull()) |
606 url = frame->document().url(); | 606 url = frame->document().url(); |
607 else | 607 else |
608 url = script_context->url(); | 608 url = script_context->url(); |
(...skipping 15 matching lines...) Expand all Loading... |
624 | 624 |
625 void NativeExtensionBindingsSystem::OnEventListenerChanged( | 625 void NativeExtensionBindingsSystem::OnEventListenerChanged( |
626 const std::string& event_name, | 626 const std::string& event_name, |
627 binding::EventListenersChanged change, | 627 binding::EventListenersChanged change, |
628 v8::Local<v8::Context> context) { | 628 v8::Local<v8::Context> context) { |
629 send_event_listener_ipc_.Run( | 629 send_event_listener_ipc_.Run( |
630 change, ScriptContextSet::GetContextByV8Context(context), event_name); | 630 change, ScriptContextSet::GetContextByV8Context(context), event_name); |
631 } | 631 } |
632 | 632 |
633 } // namespace extensions | 633 } // namespace extensions |
OLD | NEW |