| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "content/child/webmessageportchannel_impl.h" | 17 #include "content/child/webmessageportchannel_impl.h" |
| 18 #include "content/common/service_worker/service_worker_types.h" | 18 #include "content/common/service_worker/service_worker_types.h" |
| 19 #include "content/renderer/service_worker/service_worker_cache_storage_dispatche
r.h" | |
| 20 #include "content/renderer/service_worker/webserviceworkercachestorage_impl.h" | |
| 21 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" | 19 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" |
| 22 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" | 20 #include "third_party/WebKit/public/platform/WebMessagePortChannel.h" |
| 23 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheStorage.h" | |
| 24 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsClaimCallbac
ks.h" | 21 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsClaimCallbac
ks.h" |
| 25 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h" | 22 #include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h" |
| 26 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" | 23 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
| 27 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" | 24 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" |
| 28 #include "third_party/WebKit/public/platform/WebServiceWorkerSkipWaitingCallback
s.h" | 25 #include "third_party/WebKit/public/platform/WebServiceWorkerSkipWaitingCallback
s.h" |
| 29 | 26 |
| 30 namespace blink { | 27 namespace blink { |
| 31 struct WebCircularGeofencingRegion; | 28 struct WebCircularGeofencingRegion; |
| 32 struct WebCrossOriginServiceWorkerClient; | 29 struct WebCrossOriginServiceWorkerClient; |
| 33 struct WebServiceWorkerClientQueryOptions; | 30 struct WebServiceWorkerClientQueryOptions; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void SkipWaiting(blink::WebServiceWorkerSkipWaitingCallbacks* callbacks); | 92 void SkipWaiting(blink::WebServiceWorkerSkipWaitingCallbacks* callbacks); |
| 96 void ClaimClients(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); | 93 void ClaimClients(blink::WebServiceWorkerClientsClaimCallbacks* callbacks); |
| 97 | 94 |
| 98 // Send a message to the browser. Takes ownership of |message|. | 95 // Send a message to the browser. Takes ownership of |message|. |
| 99 void Send(IPC::Message* message); | 96 void Send(IPC::Message* message); |
| 100 | 97 |
| 101 // Get routing_id for sending message to the ServiceWorkerVersion | 98 // Get routing_id for sending message to the ServiceWorkerVersion |
| 102 // in the browser process. | 99 // in the browser process. |
| 103 int GetRoutingID() const; | 100 int GetRoutingID() const; |
| 104 | 101 |
| 105 // TODO(jsbell): Remove when CacheStorage creation is moved. crbug.com/439389 | |
| 106 blink::WebServiceWorkerCacheStorage* cache_storage() const { | |
| 107 return cache_storage_.get(); | |
| 108 } | |
| 109 | |
| 110 private: | 102 private: |
| 111 typedef IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer> | 103 typedef IDMap<blink::WebServiceWorkerClientsCallbacks, IDMapOwnPointer> |
| 112 ClientsCallbacksMap; | 104 ClientsCallbacksMap; |
| 113 typedef IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer> | 105 typedef IDMap<blink::WebServiceWorkerClientsClaimCallbacks, IDMapOwnPointer> |
| 114 ClaimClientsCallbacksMap; | 106 ClaimClientsCallbacksMap; |
| 115 typedef IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer> | 107 typedef IDMap<blink::WebServiceWorkerClientCallbacks, IDMapOwnPointer> |
| 116 ClientCallbacksMap; | 108 ClientCallbacksMap; |
| 117 typedef IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer> | 109 typedef IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer> |
| 118 SkipWaitingCallbacksMap; | 110 SkipWaitingCallbacksMap; |
| 119 | 111 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void OnDidSkipWaiting(int request_id); | 143 void OnDidSkipWaiting(int request_id); |
| 152 void OnDidClaimClients(int request_id); | 144 void OnDidClaimClients(int request_id); |
| 153 void OnClaimClientsError(int request_id, | 145 void OnClaimClientsError(int request_id, |
| 154 blink::WebServiceWorkerError::ErrorType error_type, | 146 blink::WebServiceWorkerError::ErrorType error_type, |
| 155 const base::string16& message); | 147 const base::string16& message); |
| 156 void OnPing(); | 148 void OnPing(); |
| 157 | 149 |
| 158 // Not owned; embedded_context_ owns this. | 150 // Not owned; embedded_context_ owns this. |
| 159 EmbeddedWorkerContextClient* embedded_context_; | 151 EmbeddedWorkerContextClient* embedded_context_; |
| 160 | 152 |
| 161 scoped_ptr<WebServiceWorkerCacheStorageImpl> cache_storage_; | |
| 162 | |
| 163 // Not owned; this object is destroyed when proxy_ becomes invalid. | 153 // Not owned; this object is destroyed when proxy_ becomes invalid. |
| 164 blink::WebServiceWorkerContextProxy* proxy_; | 154 blink::WebServiceWorkerContextProxy* proxy_; |
| 165 | 155 |
| 166 // Used for incoming messages from the browser for which an outgoing response | 156 // Used for incoming messages from the browser for which an outgoing response |
| 167 // back to the browser is expected, the id must be sent back with the | 157 // back to the browser is expected, the id must be sent back with the |
| 168 // response. | 158 // response. |
| 169 int current_request_id_; | 159 int current_request_id_; |
| 170 | 160 |
| 171 // Pending callbacks for GetClientDocuments(). | 161 // Pending callbacks for GetClientDocuments(). |
| 172 ClientsCallbacksMap pending_clients_callbacks_; | 162 ClientsCallbacksMap pending_clients_callbacks_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 186 std::map<int, base::TimeTicks> install_start_timings_; | 176 std::map<int, base::TimeTicks> install_start_timings_; |
| 187 std::map<int, base::TimeTicks> notification_click_start_timings_; | 177 std::map<int, base::TimeTicks> notification_click_start_timings_; |
| 188 std::map<int, base::TimeTicks> push_start_timings_; | 178 std::map<int, base::TimeTicks> push_start_timings_; |
| 189 | 179 |
| 190 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); | 180 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerScriptContext); |
| 191 }; | 181 }; |
| 192 | 182 |
| 193 } // namespace content | 183 } // namespace content |
| 194 | 184 |
| 195 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ | 185 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_CONTEXT_H_ |
| OLD | NEW |