Chromium Code Reviews| Index: mojo/public/cpp/application/lib/service_registry.h |
| diff --git a/mojo/public/cpp/application/lib/service_registry.h b/mojo/public/cpp/application/lib/service_registry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1ac6d6f94ce33db01fe9ee3727b4df4233dcbc1 |
| --- /dev/null |
| +++ b/mojo/public/cpp/application/lib/service_registry.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
| +#define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
| + |
| +#include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
| + |
| +namespace mojo { |
| + |
| +class Application; |
| + |
| +namespace internal { |
| + |
| +class ServiceConnectorBase; |
| + |
| +class ServiceRegistry : public ServiceProvider { |
|
darin (slow to review)
2014/06/12 16:11:51
since the ServiceRegistry is a ServiceProvider and
DaveMoore
2014/06/12 16:28:14
Done.
|
| + public: |
| + ServiceRegistry(Application* application); |
| + ServiceRegistry(Application* application, |
| + ScopedMessagePipeHandle service_provider_handle); |
| + virtual ~ServiceRegistry(); |
| + |
| + void AddServiceConnector(ServiceConnectorBase* service_connector); |
| + void RemoveServiceConnector(ServiceConnectorBase* service_connector); |
| + |
| + ServiceProvider* service_provider() { return service_provider_.get(); } |
| + void BindServiceProvider(ScopedMessagePipeHandle service_provider_handle); |
| + |
| + // ServiceProvider method. |
| + virtual void ConnectToService(const mojo::String& service_url, |
| + const mojo::String& service_name, |
| + ScopedMessagePipeHandle client_handle, |
| + const mojo::String& requestor_url) |
| + MOJO_OVERRIDE; |
| + |
| + private: |
| + Application* application_; |
| + typedef std::map<std::string, ServiceConnectorBase*> |
| + NameToServiceConnectorMap; |
| + NameToServiceConnectorMap name_to_service_connector_; |
| + ServiceProviderPtr service_provider_; |
| + |
| + MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace mojo |
| + |
| +#endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |