| 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 "mojo/public/cpp/bindings/associated_binding.h" | 6 #include "mojo/public/cpp/bindings/associated_binding.h" |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 | 9 |
| 10 class AssociatedInterfaceProviderImpl::LocalProvider | 10 class AssociatedInterfaceProviderImpl::LocalProvider |
| 11 : public mojom::AssociatedInterfaceProvider { | 11 : public mojom::AssociatedInterfaceProvider { |
| 12 public: | 12 public: |
| 13 explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) | 13 explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) |
| 14 : associated_interface_provider_binding_(this) { | 14 : associated_interface_provider_binding_(this) { |
| 15 associated_interface_provider_binding_.Bind( | 15 associated_interface_provider_binding_.Bind( |
| 16 mojo::MakeRequestForTesting(proxy)); | 16 mojo::MakeIsolatedRequest(proxy)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 ~LocalProvider() override {} | 19 ~LocalProvider() override {} |
| 20 | 20 |
| 21 void SetBinderForName( | 21 void SetBinderForName( |
| 22 const std::string& name, | 22 const std::string& name, |
| 23 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { | 23 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { |
| 24 binders_[name] = binder; | 24 binders_[name] = binder; |
| 25 } | 25 } |
| 26 | 26 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 void AssociatedInterfaceProviderImpl::OverrideBinderForTesting( | 65 void AssociatedInterfaceProviderImpl::OverrideBinderForTesting( |
| 66 const std::string& name, | 66 const std::string& name, |
| 67 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { | 67 const base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>& binder) { |
| 68 DCHECK(local_provider_); | 68 DCHECK(local_provider_); |
| 69 local_provider_->SetBinderForName(name, binder); | 69 local_provider_->SetBinderForName(name, binder); |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace content | 72 } // namespace content |
| OLD | NEW |