OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 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. | |
4 | |
5 #ifndef CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_ | |
6 #define CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/task.h" | |
11 #include "ipc/ipc_channel.h" | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" | |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorkerClient.h" | |
14 | |
15 namespace WebKit { | |
16 class WebApplicationCacheHost; | |
17 class WebApplicationCacheHostClient; | |
18 class WebFrame; | |
19 class WebWorker; | |
20 } | |
21 | |
22 class WebWorkerStubBase; | |
23 | |
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 WebWorkerClientProxy : public WebKit::WebWorkerClient { | |
30 public: | |
31 WebWorkerClientProxy(int route_id, WebWorkerStubBase* stub); | |
32 virtual ~WebWorkerClientProxy(); | |
33 | |
34 // WebWorkerClient implementation. | |
35 virtual void postMessageToWorkerObject( | |
36 const WebKit::WebString& message, | |
37 const WebKit::WebMessagePortChannelArray& channel); | |
38 virtual void postExceptionToWorkerObject( | |
39 const WebKit::WebString& error_message, | |
40 int line_number, | |
41 const WebKit::WebString& source_url); | |
42 // TODO(caseq): The overload before is obsolete and is preserved for | |
43 // WebKit/chromium compatibility only (pure virtual is base class). | |
44 // Should be removed once WebKit part is updated. | |
45 virtual void postConsoleMessageToWorkerObject( | |
46 int destination, | |
47 int source, | |
48 int type, | |
49 int level, | |
50 const WebKit::WebString& message, | |
51 int line_number, | |
52 const WebKit::WebString& source_url) { | |
53 } | |
54 virtual void postConsoleMessageToWorkerObject( | |
55 int source, | |
56 int type, | |
57 int level, | |
58 const WebKit::WebString& message, | |
59 int line_number, | |
60 const WebKit::WebString& source_url); | |
61 virtual void confirmMessageFromWorkerObject(bool has_pending_activity); | |
62 virtual void reportPendingActivity(bool has_pending_activity); | |
63 virtual void workerContextClosed(); | |
64 virtual void workerContextDestroyed(); | |
65 virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client); | |
66 | |
67 virtual WebKit::WebNotificationPresenter* notificationPresenter(); | |
68 | |
69 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( | |
70 WebKit::WebApplicationCacheHostClient* client); | |
71 | |
72 virtual bool allowDatabase(WebKit::WebFrame* frame, | |
73 const WebKit::WebString& name, | |
74 const WebKit::WebString& display_name, | |
75 unsigned long estimated_size); | |
76 | |
77 virtual void openFileSystem(WebKit::WebFileSystem::Type type, | |
78 long long size, | |
79 bool create, | |
80 WebKit::WebFileSystemCallbacks* callbacks); | |
81 | |
82 // TODO(adamk): Remove this method once it's gone from WebKit. | |
83 virtual void openFileSystem(WebKit::WebFileSystem::Type type, | |
84 long long size, | |
85 WebKit::WebFileSystemCallbacks* callbacks); | |
86 | |
87 void EnsureWorkerContextTerminates(); | |
88 | |
89 private: | |
90 bool Send(IPC::Message* message); | |
91 | |
92 int route_id_; | |
93 int appcache_host_id_; | |
94 WebWorkerStubBase* stub_; | |
95 ScopedRunnableMethodFactory<WebWorkerClientProxy> kill_process_factory_; | |
96 | |
97 DISALLOW_COPY_AND_ASSIGN(WebWorkerClientProxy); | |
98 }; | |
99 | |
100 #endif // CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_ | |
OLD | NEW |