OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" |
9 | 12 |
10 #include "content/common/service_worker/service_worker_types.h" | 13 #include "content/common/service_worker/service_worker_types.h" |
11 | 14 |
12 namespace blink { | 15 namespace blink { |
13 class WebServiceWorkerContextProxy; | 16 class WebServiceWorkerContextProxy; |
14 } | 17 } |
15 | 18 |
16 namespace IPC { | 19 namespace IPC { |
17 class Message; | 20 class Message; |
18 } | 21 } |
(...skipping 19 matching lines...) Expand all Loading... |
38 void DidHandleFetchEvent(int request_id, | 41 void DidHandleFetchEvent(int request_id, |
39 ServiceWorkerFetchEventResult result, | 42 ServiceWorkerFetchEventResult result, |
40 const ServiceWorkerResponse& response); | 43 const ServiceWorkerResponse& response); |
41 | 44 |
42 private: | 45 private: |
43 // Send message back to the browser. | 46 // Send message back to the browser. |
44 void Send(int request_id, const IPC::Message& message); | 47 void Send(int request_id, const IPC::Message& message); |
45 | 48 |
46 void OnInstallEvent(int active_version_embedded_worker_id); | 49 void OnInstallEvent(int active_version_embedded_worker_id); |
47 void OnFetchEvent(const ServiceWorkerFetchRequest& request); | 50 void OnFetchEvent(const ServiceWorkerFetchRequest& request); |
| 51 void OnPostMessage(const base::string16& message, |
| 52 const std::vector<int>& sent_message_port_ids, |
| 53 const std::vector<int>& new_routing_ids); |
48 | 54 |
49 // Not owned; embedded_context_ owns this. | 55 // Not owned; embedded_context_ owns this. |
50 EmbeddedWorkerContextClient* embedded_context_; | 56 EmbeddedWorkerContextClient* embedded_context_; |
51 | 57 |
52 // Not owned; this object is destroyed when proxy_ becomes invalid. | 58 // Not owned; this object is destroyed when proxy_ becomes invalid. |
53 blink::WebServiceWorkerContextProxy* proxy_; | 59 blink::WebServiceWorkerContextProxy* proxy_; |
54 | 60 |
55 // Used by message handlers. | 61 // Used for incoming messages from the browser for which an outgoing response |
| 62 // back to the browser is expected, the id must be sent back with the |
| 63 // response. |
56 int current_request_id_; | 64 int current_request_id_; |
57 | 65 |
58 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); | 66 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); |
59 }; | 67 }; |
60 | 68 |
61 } // namespace content | 69 } // namespace content |
62 | 70 |
63 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 71 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
OLD | NEW |