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