| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/renderer/mojo/interface_provider_js_wrapper.h" | 5 #include "content/renderer/mojo/interface_provider_js_wrapper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "content/public/common/service_names.mojom.h" | 10 #include "content/public/common/service_names.mojom.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 v8::Local<v8::Function> service_factory) { | 79 v8::Local<v8::Function> service_factory) { |
| 80 ScopedJsFactory factory(v8::Isolate::GetCurrent(), service_factory); | 80 ScopedJsFactory factory(v8::Isolate::GetCurrent(), service_factory); |
| 81 BindCallback callback = base::Bind(&InterfaceProviderJsWrapper::CallJsFactory, | 81 BindCallback callback = base::Bind(&InterfaceProviderJsWrapper::CallJsFactory, |
| 82 weak_factory_.GetWeakPtr(), factory); | 82 weak_factory_.GetWeakPtr(), factory); |
| 83 if (remote_interfaces_) { | 83 if (remote_interfaces_) { |
| 84 service_manager::InterfaceProvider::TestApi test_api( | 84 service_manager::InterfaceProvider::TestApi test_api( |
| 85 remote_interfaces_.get()); | 85 remote_interfaces_.get()); |
| 86 test_api.SetBinderForName(interface_name, callback); | 86 test_api.SetBinderForName(interface_name, callback); |
| 87 } else if (connector_) { | 87 } else if (connector_) { |
| 88 service_manager::Connector::TestApi test_api(connector_.get()); | 88 service_manager::Connector::TestApi test_api(connector_.get()); |
| 89 test_api.OverrideBinderForTesting(interface_name, callback); | 89 test_api.OverrideBinderForTesting(mojom::kBrowserServiceName, |
| 90 interface_name, callback); |
| 90 } | 91 } |
| 91 } | 92 } |
| 92 | 93 |
| 93 void InterfaceProviderJsWrapper::ClearOverridesForTesting() { | 94 void InterfaceProviderJsWrapper::ClearOverridesForTesting() { |
| 94 if (remote_interfaces_) { | 95 if (remote_interfaces_) { |
| 95 service_manager::InterfaceProvider::TestApi test_api( | 96 service_manager::InterfaceProvider::TestApi test_api( |
| 96 remote_interfaces_.get()); | 97 remote_interfaces_.get()); |
| 97 test_api.ClearBinders(); | 98 test_api.ClearBinders(); |
| 98 } else if (connector_) { | 99 } else if (connector_) { |
| 99 service_manager::Connector::TestApi test_api(connector_.get()); | 100 service_manager::Connector::TestApi test_api(connector_.get()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 143 } |
| 143 | 144 |
| 144 // static | 145 // static |
| 145 void InterfaceProviderJsWrapper::ClearContext( | 146 void InterfaceProviderJsWrapper::ClearContext( |
| 146 const v8::WeakCallbackInfo<InterfaceProviderJsWrapper>& data) { | 147 const v8::WeakCallbackInfo<InterfaceProviderJsWrapper>& data) { |
| 147 InterfaceProviderJsWrapper* registry = data.GetParameter(); | 148 InterfaceProviderJsWrapper* registry = data.GetParameter(); |
| 148 registry->context_.Reset(); | 149 registry->context_.Reset(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace content | 152 } // namespace content |
| OLD | NEW |