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"
14 class WebApplicationCacheHost
;
15 class WebApplicationCacheHostClient
;
21 class SharedWorkerDevToolsAgent
;
22 class WebSharedWorkerStub
;
24 // This class receives IPCs from the renderer and calls the WebCore::Worker
25 // implementation (after the data types have been converted by glue code). It
26 // is also called by the worker code and converts these function calls into
27 // IPCs that are sent to the renderer, where they're converted back to function
28 // calls by WebWorkerProxy.
29 class WebSharedWorkerClientProxy
: public WebKit::WebSharedWorkerClient
{
31 WebSharedWorkerClientProxy(int route_id
, WebSharedWorkerStub
* stub
);
32 virtual ~WebSharedWorkerClientProxy();
34 // WebSharedWorkerClient implementation.
35 virtual void workerContextClosed();
36 virtual void workerContextDestroyed();
38 virtual WebKit::WebNotificationPresenter
* notificationPresenter();
40 virtual WebKit::WebApplicationCacheHost
* createApplicationCacheHost(
41 WebKit::WebApplicationCacheHostClient
* client
);
43 virtual bool allowDatabase(WebKit::WebFrame
* frame
,
44 const WebKit::WebString
& name
,
45 const WebKit::WebString
& display_name
,
46 unsigned long estimated_size
);
47 virtual bool allowFileSystem();
48 virtual bool allowIndexedDB(const WebKit::WebString
&);
49 virtual void dispatchDevToolsMessage(const WebKit::WebString
&);
50 virtual void saveDevToolsAgentState(const WebKit::WebString
&);
52 void EnsureWorkerContextTerminates();
54 void set_devtools_agent(SharedWorkerDevToolsAgent
* devtools_agent
) {
55 devtools_agent_
= devtools_agent
;
59 bool Send(IPC::Message
* message
);
62 int appcache_host_id_
;
63 WebSharedWorkerStub
* stub_
;
64 base::WeakPtrFactory
<WebSharedWorkerClientProxy
> weak_factory_
;
65 SharedWorkerDevToolsAgent
* devtools_agent_
;
67 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerClientProxy
);
70 } // namespace content
72 #endif // CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_