Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: mojo/public/cpp/application/lib/service_registry.h

Issue 337533002: Introduce internal::ServiceRegistry to prepare for ServiceProvider split. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review concerns Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..478cd055ef27f17e5b96438cf97ce437bd297bfd
--- /dev/null
+++ b/mojo/public/cpp/application/lib/service_registry.h
@@ -0,0 +1,55 @@
+// 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 {
+ public:
+ ServiceRegistry(Application* application);
+ ServiceRegistry(Application* application,
+ ScopedMessagePipeHandle service_provider_handle);
+ virtual ~ServiceRegistry();
+
+ void AddServiceConnector(ServiceConnectorBase* service_connector);
+ void RemoveServiceConnector(ServiceConnectorBase* service_connector);
+
+ ServiceProvider* remote_service_provider() {
+ return remote_service_provider_.get();
+ }
+
+ void BindRemoteServiceProvider(
+ 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 remote_service_provider_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry);
+};
+
+} // namespace internal
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_

Powered by Google App Engine
This is Rietveld 408576698