#ifndef CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_
#define CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "ipc/ipc_channel.h"
#include "third_party/WebKit/public/web/WebSharedWorkerClient.h"
namespace blink {
class WebApplicationCacheHost;
class WebApplicationCacheHostClient;
class WebFrame;
class WebSecurityOrigin;
}
namespace content {
class SharedWorkerDevToolsAgent;
class WebSharedWorkerStub;
class WorkerWebApplicationCacheHostImpl;
class WebSharedWorkerClientProxy : public blink::WebSharedWorkerClient {
public:
WebSharedWorkerClientProxy(int route_id, WebSharedWorkerStub* stub);
virtual ~WebSharedWorkerClientProxy();
virtual void workerContextClosed();
virtual void workerContextDestroyed();
virtual void workerScriptLoaded();
virtual void workerScriptLoadFailed();
virtual void selectAppCacheID(long long app_cache_id);
virtual blink::WebNotificationPresenter* notificationPresenter();
virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
blink::WebApplicationCacheHostClient* client);
virtual blink::WebWorkerPermissionClientProxy*
createWorkerPermissionClientProxy(
const blink::WebSecurityOrigin& origin);
virtual void dispatchDevToolsMessage(const blink::WebString&);
virtual void saveDevToolsAgentState(const blink::WebString&);
void EnsureWorkerContextTerminates();
void set_devtools_agent(SharedWorkerDevToolsAgent* devtools_agent) {
devtools_agent_ = devtools_agent;
}
private:
bool Send(IPC::Message* message);
int route_id_;
int appcache_host_id_;
WebSharedWorkerStub* stub_;
base::WeakPtrFactory<WebSharedWorkerClientProxy> weak_factory_;
SharedWorkerDevToolsAgent* devtools_agent_;
WorkerWebApplicationCacheHostImpl* app_cache_host_;
DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerClientProxy);
};
}
#endif