#ifndef MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_
#define MOJO_SHELL_DYNAMIC_SERVICE_LOADER_H_
#include <map>
#include "base/macros.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/interfaces/shell/shell.mojom.h"
#include "mojo/service_manager/service_loader.h"
#include "mojo/shell/dynamic_service_runner.h"
#include "mojo/shell/keep_alive.h"
#include "url/gurl.h"
namespace mojo {
namespace shell {
class Context;
class DynamicServiceRunnerFactory;
class DynamicServiceLoader : public ServiceLoader {
public:
DynamicServiceLoader(Context* context,
scoped_ptr<DynamicServiceRunnerFactory> runner_factory);
virtual ~DynamicServiceLoader();
virtual void LoadService(ServiceManager* manager,
const GURL& url,
ScopedShellHandle service_handle) OVERRIDE;
virtual void OnServiceError(ServiceManager* manager, const GURL& url)
OVERRIDE;
private:
class LoadContext;
void AppCompleted(const GURL& url);
Context* const context_;
scoped_ptr<DynamicServiceRunnerFactory> runner_factory_;
typedef std::map<GURL, LoadContext*> LoadContextMap;
LoadContextMap url_to_load_context_;
DISALLOW_COPY_AND_ASSIGN(DynamicServiceLoader);
};
}
}
#endif