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 #ifndef MOJO_PUBLIC_APPLICATION_SERVICE_PROVIDER_IMPL_H_ | 5 #ifndef MOJO_PUBLIC_APPLICATION_SERVICE_PROVIDER_IMPL_H_ |
6 #define MOJO_PUBLIC_APPLICATION_SERVICE_PROVIDER_IMPL_H_ | 6 #define MOJO_PUBLIC_APPLICATION_SERVICE_PROVIDER_IMPL_H_ |
7 | 7 |
8 #include "mojo/public/cpp/application/lib/service_connector.h" | 8 #include "mojo/public/cpp/application/lib/service_connector.h" |
9 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 9 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // encapsulates, the lifetime of the ServiceProvider instance returned by this | 32 // encapsulates, the lifetime of the ServiceProvider instance returned by this |
33 // method is assumed by the caller. After the pipe is closed | 33 // method is assumed by the caller. After the pipe is closed |
34 // ConnectToService() calls on this object will be silently dropped. | 34 // ConnectToService() calls on this object will be silently dropped. |
35 // This method must only be called once per ServiceProviderImpl. | 35 // This method must only be called once per ServiceProviderImpl. |
36 ServiceProvider* CreateRemoteServiceProvider(); | 36 ServiceProvider* CreateRemoteServiceProvider(); |
37 | 37 |
38 private: | 38 private: |
39 typedef std::map<std::string, internal::ServiceConnectorBase*> | 39 typedef std::map<std::string, internal::ServiceConnectorBase*> |
40 NameToServiceConnectorMap; | 40 NameToServiceConnectorMap; |
41 | 41 |
| 42 friend class internal::WeakServiceProvider; |
| 43 |
42 // Overridden from ServiceProvider: | 44 // Overridden from ServiceProvider: |
43 virtual void ConnectToService( | 45 virtual void ConnectToService( |
44 const String& service_name, | 46 const String& service_name, |
45 ScopedMessagePipeHandle client_handle) MOJO_OVERRIDE; | 47 ScopedMessagePipeHandle client_handle) MOJO_OVERRIDE; |
46 | 48 |
47 // Overridden from InterfaceImpl: | 49 // Overridden from InterfaceImpl: |
48 virtual void OnConnectionError() MOJO_OVERRIDE; | 50 virtual void OnConnectionError() MOJO_OVERRIDE; |
49 | 51 |
50 void AddServiceConnector( | 52 void AddServiceConnector( |
51 internal::ServiceConnectorBase* service_connector); | 53 internal::ServiceConnectorBase* service_connector); |
52 void RemoveServiceConnector( | 54 void RemoveServiceConnector( |
53 internal::ServiceConnectorBase* service_connector); | 55 internal::ServiceConnectorBase* service_connector); |
54 | 56 |
| 57 void ClearRemote(); |
| 58 |
55 NameToServiceConnectorMap service_connectors_; | 59 NameToServiceConnectorMap service_connectors_; |
56 | 60 |
57 internal::WeakServiceProvider* remote_; | 61 internal::WeakServiceProvider* remote_; |
58 | 62 |
59 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceProviderImpl); | 63 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceProviderImpl); |
60 }; | 64 }; |
61 | 65 |
62 } // namespace mojo | 66 } // namespace mojo |
63 | 67 |
64 #endif // MOJO_PUBLIC_APPLICATION_SERVICE_PROVIDER_IMPL_H_ | 68 #endif // MOJO_PUBLIC_APPLICATION_SERVICE_PROVIDER_IMPL_H_ |
OLD | NEW |