Initial implementation of the permission API for Browser Plugin PointerLock
[chromium-blink-merge.git] / content / worker / websharedworkerclient_proxy.h
blob504cad8e36a142cdf595eaa746694e47b491433a
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/Source/Platform/chromium/public/WebFileSystem.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSharedWorkerClient.h"
14 namespace WebKit {
15 class WebApplicationCacheHost;
16 class WebApplicationCacheHostClient;
17 class WebFrame;
20 namespace content {
22 class SharedWorkerDevToolsAgent;
23 class WebSharedWorkerStub;
25 // This class receives IPCs from the renderer and calls the WebCore::Worker
26 // implementation (after the data types have been converted by glue code). It
27 // is also called by the worker code and converts these function calls into
28 // IPCs that are sent to the renderer, where they're converted back to function
29 // calls by WebWorkerProxy.
30 class WebSharedWorkerClientProxy : public WebKit::WebSharedWorkerClient {
31 public:
32 WebSharedWorkerClientProxy(int route_id, WebSharedWorkerStub* stub);
33 virtual ~WebSharedWorkerClientProxy();
35 // WebSharedWorkerClient implementation.
36 virtual void postMessageToWorkerObject(
37 const WebKit::WebString& message,
38 const WebKit::WebMessagePortChannelArray& channel);
39 virtual void postExceptionToWorkerObject(
40 const WebKit::WebString& error_message,
41 int line_number,
42 const WebKit::WebString& source_url);
43 // TODO(caseq): The overload before is obsolete and is preserved for
44 // WebKit/chromium compatibility only (pure virtual is base class).
45 // Should be removed once WebKit part is updated.
46 virtual void postConsoleMessageToWorkerObject(
47 int destination,
48 int source,
49 int type,
50 int level,
51 const WebKit::WebString& message,
52 int line_number,
53 const WebKit::WebString& source_url) {
55 virtual void postConsoleMessageToWorkerObject(
56 int source,
57 int type,
58 int level,
59 const WebKit::WebString& message,
60 int line_number,
61 const WebKit::WebString& source_url);
62 virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
63 virtual void reportPendingActivity(bool has_pending_activity);
64 virtual void workerContextClosed();
65 virtual void workerContextDestroyed();
67 virtual WebKit::WebNotificationPresenter* notificationPresenter();
69 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
70 WebKit::WebApplicationCacheHostClient* client);
72 virtual bool allowDatabase(WebKit::WebFrame* frame,
73 const WebKit::WebString& name,
74 const WebKit::WebString& display_name,
75 unsigned long estimated_size);
76 virtual bool allowFileSystem();
77 virtual void openFileSystem(WebKit::WebFileSystem::Type type,
78 long long size,
79 bool create,
80 WebKit::WebFileSystemCallbacks* callbacks);
81 virtual bool allowIndexedDB(const WebKit::WebString&);
82 virtual void dispatchDevToolsMessage(const WebKit::WebString&);
83 virtual void saveDevToolsAgentState(const WebKit::WebString&);
85 void EnsureWorkerContextTerminates();
87 void set_devtools_agent(SharedWorkerDevToolsAgent* devtools_agent) {
88 devtools_agent_ = devtools_agent;
91 private:
92 bool Send(IPC::Message* message);
94 int route_id_;
95 int appcache_host_id_;
96 WebSharedWorkerStub* stub_;
97 base::WeakPtrFactory<WebSharedWorkerClientProxy> weak_factory_;
98 SharedWorkerDevToolsAgent* devtools_agent_;
100 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerClientProxy);
103 } // namespace content
105 #endif // CONTENT_WORKER_WEBWORKERCLIENT_PROXY_H_