| 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 "content/common/associated_interface_provider_impl.h" | 5 #include "content/common/associated_interface_provider_impl.h" |
| 6 #include "base/callback.h" |
| 7 #include "base/run_loop.h" |
| 6 #include "mojo/public/cpp/bindings/associated_binding.h" | 8 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 7 | 9 |
| 8 namespace content { | 10 namespace content { |
| 9 | 11 |
| 10 class AssociatedInterfaceProviderImpl::LocalProvider | 12 class AssociatedInterfaceProviderImpl::LocalProvider |
| 11 : public mojom::AssociatedInterfaceProvider { | 13 : public mojom::AssociatedInterfaceProvider { |
| 12 public: | 14 public: |
| 13 explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) | 15 explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) |
| 14 : associated_interface_provider_binding_(this) { | 16 : associated_interface_provider_binding_(this) { |
| 15 associated_interface_provider_binding_.Bind( | 17 associated_interface_provider_binding_.Bind( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl() | 54 AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl() |
| 53 : local_provider_(new LocalProvider(&proxy_)) {} | 55 : local_provider_(new LocalProvider(&proxy_)) {} |
| 54 | 56 |
| 55 AssociatedInterfaceProviderImpl::~AssociatedInterfaceProviderImpl() {} | 57 AssociatedInterfaceProviderImpl::~AssociatedInterfaceProviderImpl() {} |
| 56 | 58 |
| 57 void AssociatedInterfaceProviderImpl::GetInterface( | 59 void AssociatedInterfaceProviderImpl::GetInterface( |
| 58 const std::string& name, | 60 const std::string& name, |
| 59 mojo::ScopedInterfaceEndpointHandle handle) { | 61 mojo::ScopedInterfaceEndpointHandle handle) { |
| 60 mojom::AssociatedInterfaceAssociatedRequest request; | 62 mojom::AssociatedInterfaceAssociatedRequest request; |
| 61 request.Bind(std::move(handle)); | 63 request.Bind(std::move(handle)); |
| 62 return proxy_->GetAssociatedInterface(name, std::move(request)); | 64 proxy_->GetAssociatedInterface(name, std::move(request)); |
| 63 } | 65 } |
| 64 | 66 |
| 65 void AssociatedInterfaceProviderImpl::OverrideBinderForTesting( | 67 void AssociatedInterfaceProviderImpl::OverrideBinderForTesting( |
| 66 const std::string& name, | 68 const std::string& name, |
| 67 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { | 69 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { |
| 68 DCHECK(local_provider_); | 70 DCHECK(local_provider_); |
| 69 local_provider_->SetBinderForName(name, binder); | 71 local_provider_->SetBinderForName(name, binder); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace content | 74 } // namespace content |
| OLD | NEW |