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_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ | 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ | 6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
7 | 7 |
8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
9 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 9 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // other. | 22 // other. |
23 class ServiceRegistry : public ServiceProvider, public ApplicationConnection { | 23 class ServiceRegistry : public ServiceProvider, public ApplicationConnection { |
24 public: | 24 public: |
25 ServiceRegistry(); | 25 ServiceRegistry(); |
26 ServiceRegistry(ApplicationImpl* application_impl, | 26 ServiceRegistry(ApplicationImpl* application_impl, |
27 const std::string& url, | 27 const std::string& url, |
28 ServiceProviderPtr service_provider); | 28 ServiceProviderPtr service_provider); |
29 virtual ~ServiceRegistry(); | 29 virtual ~ServiceRegistry(); |
30 | 30 |
31 // ApplicationConnection overrides. | 31 // ApplicationConnection overrides. |
32 virtual void AddServiceConnector(ServiceConnectorBase* service_connector) | 32 virtual void AddServiceConnector( |
33 MOJO_OVERRIDE; | 33 ServiceConnectorBase* service_connector) override; |
34 virtual const std::string& GetRemoteApplicationURL() MOJO_OVERRIDE; | 34 virtual const std::string& GetRemoteApplicationURL() override; |
35 virtual ApplicationConnection* ConnectToApplication( | 35 virtual ApplicationConnection* ConnectToApplication( |
36 const std::string& url) MOJO_OVERRIDE; | 36 const std::string& url) override; |
37 virtual ServiceProvider* GetServiceProvider() MOJO_OVERRIDE; | 37 virtual ServiceProvider* GetServiceProvider() override; |
38 | 38 |
39 virtual void RemoveServiceConnector(ServiceConnectorBase* service_connector); | 39 virtual void RemoveServiceConnector(ServiceConnectorBase* service_connector); |
40 | 40 |
41 private: | 41 private: |
42 // ServiceProvider method. | 42 // ServiceProvider method. |
43 virtual void ConnectToService(const mojo::String& service_name, | 43 virtual void ConnectToService(const mojo::String& service_name, |
44 ScopedMessagePipeHandle client_handle) | 44 ScopedMessagePipeHandle client_handle) override; |
45 MOJO_OVERRIDE; | |
46 | 45 |
47 ApplicationImpl* application_impl_; | 46 ApplicationImpl* application_impl_; |
48 const std::string url_; | 47 const std::string url_; |
49 | 48 |
50 private: | 49 private: |
51 bool RemoveServiceConnectorInternal( | 50 bool RemoveServiceConnectorInternal( |
52 ServiceConnectorBase* service_connector); | 51 ServiceConnectorBase* service_connector); |
53 | 52 |
54 Application* application_; | 53 Application* application_; |
55 typedef std::map<std::string, ServiceConnectorBase*> | 54 typedef std::map<std::string, ServiceConnectorBase*> |
56 NameToServiceConnectorMap; | 55 NameToServiceConnectorMap; |
57 NameToServiceConnectorMap name_to_service_connector_; | 56 NameToServiceConnectorMap name_to_service_connector_; |
58 ServiceProviderPtr remote_service_provider_; | 57 ServiceProviderPtr remote_service_provider_; |
59 | 58 |
60 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); | 59 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); |
61 }; | 60 }; |
62 | 61 |
63 } // namespace internal | 62 } // namespace internal |
64 } // namespace mojo | 63 } // namespace mojo |
65 | 64 |
66 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ | 65 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
OLD | NEW |