android: Add screen recording tool
[chromium-blink-merge.git] / content / worker / websharedworker_stub.h
blob012decd29416944e1f8b8a405da39babd6874ae4
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_WEBSHAREDWORKER_STUB_H_
6 #define CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/worker/websharedworkerclient_proxy.h"
10 #include "content/worker/worker_webapplicationcachehost_impl.h"
11 #include "ipc/ipc_listener.h"
12 #include "third_party/WebKit/public/web/WebSharedWorker.h"
13 #include "url/gurl.h"
15 namespace blink {
16 class WebSharedWorker;
19 namespace content {
21 class SharedWorkerDevToolsAgent;
23 // This class creates a WebSharedWorker, and translates incoming IPCs to the
24 // appropriate WebSharedWorker APIs.
25 class WebSharedWorkerStub : public IPC::Listener {
26 public:
27 WebSharedWorkerStub(const string16& name, int route_id,
28 const WorkerAppCacheInitInfo& appcache_init_info);
30 // IPC::Listener implementation.
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
32 virtual void OnChannelError() OVERRIDE;
34 // Invoked when the WebSharedWorkerClientProxy is shutting down.
35 void Shutdown();
37 // Called after terminating the worker context to make sure that the worker
38 // actually terminates (is not stuck in an infinite loop).
39 void EnsureWorkerContextTerminates();
41 WebSharedWorkerClientProxy* client() { return &client_; }
43 const WorkerAppCacheInitInfo& appcache_init_info() const {
44 return appcache_init_info_;
47 // Returns the script url of this worker.
48 const GURL& url();
51 private:
52 virtual ~WebSharedWorkerStub();
54 void OnConnect(int sent_message_port_id, int routing_id);
55 void OnStartWorkerContext(
56 const GURL& url, const string16& user_agent, const string16& source_code,
57 const string16& content_security_policy,
58 blink::WebContentSecurityPolicyType policy_type);
60 void OnTerminateWorkerContext();
62 int route_id_;
63 WorkerAppCacheInitInfo appcache_init_info_;
65 // WebSharedWorkerClient that responds to outgoing API calls
66 // from the worker object.
67 WebSharedWorkerClientProxy client_;
69 blink::WebSharedWorker* impl_;
70 string16 name_;
71 bool started_;
72 GURL url_;
73 scoped_ptr<SharedWorkerDevToolsAgent> worker_devtools_agent_;
75 typedef std::pair<int, int> PendingConnectInfo;
76 typedef std::vector<PendingConnectInfo> PendingConnectInfoList;
77 PendingConnectInfoList pending_connects_;
79 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerStub);
82 } // namespace content
84 #endif // CONTENT_WORKER_WEBSHAREDWORKER_STUB_H_