IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / worker / websharedworkerclient_proxy.h
blobbeb3086d756a5a87f19fcc59c27e7effbccceef0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_
6 #define CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ipc/ipc_channel.h"
11 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h"
13 namespace blink {
14 class WebApplicationCacheHost;
15 class WebApplicationCacheHostClient;
16 class WebFrame;
17 class WebSecurityOrigin;
20 namespace content {
22 class SharedWorkerDevToolsAgent;
23 class WebSharedWorkerStub;
24 class WorkerWebApplicationCacheHostImpl;
26 // This class receives IPCs from the renderer and calls the WebCore::Worker
27 // implementation (after the data types have been converted by glue code). It
28 // is also called by the worker code and converts these function calls into
29 // IPCs that are sent to the renderer, where they're converted back to function
30 // calls by WebWorkerProxy.
31 class WebSharedWorkerClientProxy : public blink::WebSharedWorkerClient {
32 public:
33 WebSharedWorkerClientProxy(int route_id, WebSharedWorkerStub* stub);
34 virtual ~WebSharedWorkerClientProxy();
36 // WebSharedWorkerClient implementation.
37 virtual void workerContextClosed();
38 virtual void workerContextDestroyed();
39 virtual void workerScriptLoaded();
40 virtual void workerScriptLoadFailed();
41 virtual void selectAppCacheID(long long app_cache_id);
43 virtual blink::WebNotificationPresenter* notificationPresenter();
45 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
46 blink::WebApplicationCacheHostClient* client);
47 virtual blink::WebWorkerPermissionClientProxy*
48 createWorkerPermissionClientProxy(
49 const blink::WebSecurityOrigin& origin);
51 virtual void dispatchDevToolsMessage(const blink::WebString&);
52 virtual void saveDevToolsAgentState(const blink::WebString&);
54 void EnsureWorkerContextTerminates();
56 void set_devtools_agent(SharedWorkerDevToolsAgent* devtools_agent) {
57 devtools_agent_ = devtools_agent;
60 private:
61 bool Send(IPC::Message* message);
63 int route_id_;
64 int appcache_host_id_;
65 WebSharedWorkerStub* stub_;
66 base::WeakPtrFactory<WebSharedWorkerClientProxy> weak_factory_;
67 SharedWorkerDevToolsAgent* devtools_agent_;
68 WorkerWebApplicationCacheHostImpl* app_cache_host_;
70 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerClientProxy);
73 } // namespace content
75 #endif // CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_