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 #ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_ | 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_ |
6 #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_ | 6 #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_ |
7 | 7 |
8 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 8 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
9 | 9 |
10 namespace shell { | 10 namespace shell { |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 void ClearBinders() { | 32 void ClearBinders() { |
33 provider_->ClearBinders(); | 33 provider_->ClearBinders(); |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
37 InterfaceProvider* provider_; | 37 InterfaceProvider* provider_; |
38 DISALLOW_COPY_AND_ASSIGN(TestApi); | 38 DISALLOW_COPY_AND_ASSIGN(TestApi); |
39 }; | 39 }; |
40 | 40 |
41 explicit InterfaceProvider(mojom::InterfaceProviderPtr interface_provider); | 41 InterfaceProvider(); |
42 ~InterfaceProvider(); | 42 ~InterfaceProvider(); |
43 | 43 |
| 44 void Bind(mojom::InterfaceProviderPtr interface_provider); |
| 45 |
44 // Returns a raw pointer to the remote InterfaceProvider. | 46 // Returns a raw pointer to the remote InterfaceProvider. |
45 mojom::InterfaceProvider* get() { return interface_provider_.get(); } | 47 mojom::InterfaceProvider* get() { return interface_provider_.get(); } |
46 | 48 |
47 // Sets a closure to be run when the remote InterfaceProvider pipe is closed. | 49 // Sets a closure to be run when the remote InterfaceProvider pipe is closed. |
48 void SetConnectionLostClosure(const base::Closure& connection_lost_closure); | 50 void SetConnectionLostClosure(const base::Closure& connection_lost_closure); |
49 | 51 |
50 base::WeakPtr<InterfaceProvider> GetWeakPtr(); | 52 base::WeakPtr<InterfaceProvider> GetWeakPtr(); |
51 | 53 |
52 // Binds |ptr| to an implementation of Interface in the remote application. | 54 // Binds |ptr| to an implementation of Interface in the remote application. |
53 // |ptr| can immediately be used to start sending requests to the remote | 55 // |ptr| can immediately be used to start sending requests to the remote |
(...skipping 27 matching lines...) Expand all Loading... |
81 mojom::InterfaceProviderPtr interface_provider_; | 83 mojom::InterfaceProviderPtr interface_provider_; |
82 | 84 |
83 base::WeakPtrFactory<InterfaceProvider> weak_factory_; | 85 base::WeakPtrFactory<InterfaceProvider> weak_factory_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(InterfaceProvider); | 87 DISALLOW_COPY_AND_ASSIGN(InterfaceProvider); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace shell | 90 } // namespace shell |
89 | 91 |
90 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_ | 92 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_PROVIDER_H_ |
OLD | NEW |