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

Unified Diff: mojo/shell/service_manager.h

Issue 122173004: Add test for ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update new copyrights Created 6 years, 12 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
« no previous file with comments | « mojo/shell/dynamic_service_loader.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
index 09cb8de11fc341df8af355cfa2556ce922f3b052..265a48184994cf6992a86c741184e1a744ff7a6a 100644
--- a/mojo/shell/service_manager.h
+++ b/mojo/shell/service_manager.h
@@ -7,6 +7,7 @@
#include <map>
+#include "base/basictypes.h"
#include "base/callback.h"
#include "mojo/public/system/core_cpp.h"
#include "url/gurl.h"
@@ -14,33 +15,37 @@
namespace mojo {
namespace shell {
-class Context;
-
class ServiceManager {
public:
+ // Interface to allowing default loading behavior to be overridden for a
+ // specific url.
class Loader {
public:
virtual ~Loader();
virtual void Load(const GURL& url,
- ServiceManager* manager,
ScopedMessagePipeHandle service_handle) = 0;
protected:
Loader();
};
- explicit ServiceManager(Context* context);
+ ServiceManager();
~ServiceManager();
+ // Sets the default Loader to be used if not overridden by SetLoaderForURL().
+ // Does not take ownership of |loader|.
+ void set_default_loader(Loader* loader) { default_loader_ = loader; }
+ // Sets a Loader to be used for a specific url.
+ // Does not take ownership of |loader|.
void SetLoaderForURL(Loader* loader, const GURL& gurl);
+ // Returns the Loader to use for a url (using default if not overridden.)
Loader* GetLoaderForURL(const GURL& gurl);
+ // Loads a service if necessary and establishes a new client connection.
void Connect(const GURL& url, ScopedMessagePipeHandle client_handle);
private:
class Service;
- class DynamicLoader;
- Context* context_;
- scoped_ptr<Loader> default_loader_;
+ Loader* default_loader_;
typedef std::map<GURL, Service*> ServiceMap;
ServiceMap url_to_service_;
typedef std::map<GURL, Loader*> LoaderMap;
« no previous file with comments | « mojo/shell/dynamic_service_loader.cc ('k') | mojo/shell/service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698