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