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

Unified Diff: mojo/shell/service_manager.h

Issue 93793009: Implement ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow Android to be built Created 7 years 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
« no previous file with comments | « mojo/shell/run.cc ('k') | mojo/shell/service_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/service_manager.h
diff --git a/mojo/shell/service_manager.h b/mojo/shell/service_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..09cb8de11fc341df8af355cfa2556ce922f3b052
--- /dev/null
+++ b/mojo/shell/service_manager.h
@@ -0,0 +1,54 @@
+// Copyright 2013 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_SHELL_SERVICE_MANAGER_H_
+#define MOJO_SHELL_SERVICE_MANAGER_H_
+
+#include <map>
+
+#include "base/callback.h"
+#include "mojo/public/system/core_cpp.h"
+#include "url/gurl.h"
+
+namespace mojo {
+namespace shell {
+
+class Context;
+
+class ServiceManager {
+ public:
+ class Loader {
+ public:
+ virtual ~Loader();
+ virtual void Load(const GURL& url,
+ ServiceManager* manager,
+ ScopedMessagePipeHandle service_handle) = 0;
+ protected:
+ Loader();
+ };
+
+ explicit ServiceManager(Context* context);
+ ~ServiceManager();
+
+ void SetLoaderForURL(Loader* loader, const GURL& gurl);
+ Loader* GetLoaderForURL(const GURL& gurl);
+ void Connect(const GURL& url, ScopedMessagePipeHandle client_handle);
+
+ private:
+ class Service;
+ class DynamicLoader;
+
+ Context* context_;
+ scoped_ptr<Loader> default_loader_;
+ typedef std::map<GURL, Service*> ServiceMap;
+ ServiceMap url_to_service_;
+ typedef std::map<GURL, Loader*> LoaderMap;
+ LoaderMap url_to_loader_;
+ DISALLOW_COPY_AND_ASSIGN(ServiceManager);
+};
+
+} // namespace shell
+} // namespace mojo
+
+#endif // MOJO_SHELL_SERVICE_MANAGER_H_
« no previous file with comments | « mojo/shell/run.cc ('k') | mojo/shell/service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698