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> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // potential EW/SW layering concerns. | 31 // potential EW/SW layering concerns. |
32 class ServiceWorkerScriptContext { | 32 class ServiceWorkerScriptContext { |
33 public: | 33 public: |
34 ServiceWorkerScriptContext( | 34 ServiceWorkerScriptContext( |
35 EmbeddedWorkerContextClient* embedded_context, | 35 EmbeddedWorkerContextClient* embedded_context, |
36 blink::WebServiceWorkerContextProxy* proxy); | 36 blink::WebServiceWorkerContextProxy* proxy); |
37 ~ServiceWorkerScriptContext(); | 37 ~ServiceWorkerScriptContext(); |
38 | 38 |
39 void OnMessageReceived(int request_id, const IPC::Message& message); | 39 void OnMessageReceived(int request_id, const IPC::Message& message); |
40 | 40 |
| 41 void DidHandleActivateEvent(int request_id, |
| 42 blink::WebServiceWorkerEventResult); |
41 void DidHandleInstallEvent(int request_id, | 43 void DidHandleInstallEvent(int request_id, |
42 blink::WebServiceWorkerEventResult result); | 44 blink::WebServiceWorkerEventResult result); |
43 void DidHandleFetchEvent(int request_id, | 45 void DidHandleFetchEvent(int request_id, |
44 ServiceWorkerFetchEventResult result, | 46 ServiceWorkerFetchEventResult result, |
45 const ServiceWorkerResponse& response); | 47 const ServiceWorkerResponse& response); |
46 | 48 |
47 private: | 49 private: |
48 // Send message back to the browser. | 50 // Send message back to the browser. |
49 void Send(int request_id, const IPC::Message& message); | 51 void Send(int request_id, const IPC::Message& message); |
50 | 52 |
| 53 void OnActivateEvent(); |
51 void OnInstallEvent(int active_version_id); | 54 void OnInstallEvent(int active_version_id); |
52 void OnFetchEvent(const ServiceWorkerFetchRequest& request); | 55 void OnFetchEvent(const ServiceWorkerFetchRequest& request); |
53 void OnPostMessage(const base::string16& message, | 56 void OnPostMessage(const base::string16& message, |
54 const std::vector<int>& sent_message_port_ids, | 57 const std::vector<int>& sent_message_port_ids, |
55 const std::vector<int>& new_routing_ids); | 58 const std::vector<int>& new_routing_ids); |
56 | 59 |
57 // Not owned; embedded_context_ owns this. | 60 // Not owned; embedded_context_ owns this. |
58 EmbeddedWorkerContextClient* embedded_context_; | 61 EmbeddedWorkerContextClient* embedded_context_; |
59 | 62 |
60 // Not owned; this object is destroyed when proxy_ becomes invalid. | 63 // Not owned; this object is destroyed when proxy_ becomes invalid. |
61 blink::WebServiceWorkerContextProxy* proxy_; | 64 blink::WebServiceWorkerContextProxy* proxy_; |
62 | 65 |
63 // Used for incoming messages from the browser for which an outgoing response | 66 // Used for incoming messages from the browser for which an outgoing response |
64 // back to the browser is expected, the id must be sent back with the | 67 // back to the browser is expected, the id must be sent back with the |
65 // response. | 68 // response. |
66 int current_request_id_; | 69 int current_request_id_; |
67 | 70 |
68 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); | 71 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); |
69 }; | 72 }; |
70 | 73 |
71 } // namespace content | 74 } // namespace content |
72 | 75 |
73 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 76 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
OLD | NEW |