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; |