Enable right clicking on the applist doodle web contents and log the data.
[chromium-blink-merge.git] / content / renderer / shared_worker / embedded_shared_worker_stub.h
blob5575de048cb88de5889f211aaf1bd616f888043f
1 // Copyright 2014 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_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H
6 #define CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H
8 #include <vector>
10 #include "content/child/child_message_filter.h"
11 #include "content/child/scoped_child_process_reference.h"
12 #include "ipc/ipc_listener.h"
13 #include "third_party/WebKit/public/platform/WebString.h"
14 #include "third_party/WebKit/public/web/WebContentSecurityPolicy.h"
15 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h"
16 #include "url/gurl.h"
18 namespace blink {
19 class WebApplicationCacheHost;
20 class WebApplicationCacheHostClient;
21 class WebMessagePortChannel;
22 class WebNotificationPresenter;
23 class WebSecurityOrigin;
24 class WebSharedWorker;
25 class WebWorkerPermissionClientProxy;
28 namespace content {
29 class SharedWorkerDevToolsAgent;
30 class WebApplicationCacheHostImpl;
31 class WebMessagePortChannelImpl;
33 class EmbeddedSharedWorkerStub : public IPC::Listener,
34 public blink::WebSharedWorkerClient {
35 public:
36 EmbeddedSharedWorkerStub(
37 const GURL& url,
38 const base::string16& name,
39 const base::string16& content_security_policy,
40 blink::WebContentSecurityPolicyType security_policy_type,
41 bool pause_on_start,
42 int route_id);
44 // IPC::Listener implementation.
45 bool OnMessageReceived(const IPC::Message& message) override;
46 void OnChannelError() override;
48 // blink::WebSharedWorkerClient implementation.
49 virtual void workerContextClosed() override;
50 virtual void workerContextDestroyed() override;
51 virtual void workerReadyForInspection() override;
52 virtual void workerScriptLoaded() override;
53 virtual void workerScriptLoadFailed() override;
54 virtual void selectAppCacheID(long long) override;
55 virtual blink::WebNotificationPresenter* notificationPresenter() override;
56 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
57 blink::WebApplicationCacheHostClient*) override;
58 virtual blink::WebWorkerPermissionClientProxy*
59 createWorkerPermissionClientProxy(
60 const blink::WebSecurityOrigin& origin) override;
61 virtual blink::WebServiceWorkerNetworkProvider*
62 createServiceWorkerNetworkProvider(blink::WebDataSource*) override;
63 virtual void sendDevToolsMessage(
64 int call_id,
65 const blink::WebString& message,
66 const blink::WebString& state) override;
68 private:
69 ~EmbeddedSharedWorkerStub() override;
71 void Shutdown();
72 bool Send(IPC::Message* message);
74 // WebSharedWorker will own |channel|.
75 void ConnectToChannel(WebMessagePortChannelImpl* channel);
77 void OnConnect(int sent_message_port_id, int routing_id);
78 void OnTerminateWorkerContext();
80 int route_id_;
81 base::string16 name_;
82 bool runing_;
83 GURL url_;
84 blink::WebSharedWorker* impl_;
85 scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_;
87 typedef std::vector<WebMessagePortChannelImpl*> PendingChannelList;
88 PendingChannelList pending_channels_;
90 ScopedChildProcessReference process_ref_;
91 WebApplicationCacheHostImpl* app_cache_host_;
92 DISALLOW_COPY_AND_ASSIGN(EmbeddedSharedWorkerStub);
95 } // namespace content
97 #endif // CONTENT_RENDERER_SHARED_WORKER_EMBEDDED_SHARED_WORKER_STUB_H