OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/common/service_worker/service_worker_types.h" | 26 #include "content/common/service_worker/service_worker_types.h" |
27 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" | 27 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h" |
28 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" | 28 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h" |
29 | 29 |
30 class GURL; | 30 class GURL; |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 struct WebCircularGeofencingRegion; | 33 struct WebCircularGeofencingRegion; |
34 } | 34 } |
35 | 35 |
| 36 namespace net { |
| 37 class HttpResponseInfo; |
| 38 } |
| 39 |
36 namespace content { | 40 namespace content { |
37 | 41 |
38 class EmbeddedWorkerRegistry; | 42 class EmbeddedWorkerRegistry; |
39 struct NavigatorConnectClient; | 43 struct NavigatorConnectClient; |
40 struct PlatformNotificationData; | 44 struct PlatformNotificationData; |
41 class ServiceWorkerContextCore; | 45 class ServiceWorkerContextCore; |
42 class ServiceWorkerProviderHost; | 46 class ServiceWorkerProviderHost; |
43 class ServiceWorkerRegistration; | 47 class ServiceWorkerRegistration; |
44 class ServiceWorkerURLRequestJob; | 48 class ServiceWorkerURLRequestJob; |
45 class ServiceWorkerVersionInfo; | 49 class ServiceWorkerVersionInfo; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // Dooms this version to have REDUNDANT status and its resources deleted. If | 289 // Dooms this version to have REDUNDANT status and its resources deleted. If |
286 // the version is controlling a page, these changes will happen when the | 290 // the version is controlling a page, these changes will happen when the |
287 // version no longer controls any pages. | 291 // version no longer controls any pages. |
288 void Doom(); | 292 void Doom(); |
289 bool is_doomed() const { return is_doomed_; } | 293 bool is_doomed() const { return is_doomed_; } |
290 | 294 |
291 bool skip_waiting() const { return skip_waiting_; } | 295 bool skip_waiting() const { return skip_waiting_; } |
292 | 296 |
293 void SetDevToolsAttached(bool attached); | 297 void SetDevToolsAttached(bool attached); |
294 | 298 |
| 299 // Sets the HttpResponseInfo used to load the main script. |
| 300 // This HttpResponseInfo will be used for all responses sent back from the |
| 301 // service worker, as the effective security of these responses is equivalent |
| 302 // to that of the ServiceWorker. |
| 303 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo& http_info); |
| 304 const net::HttpResponseInfo* GetMainScriptHttpResponseInfo(); |
| 305 |
295 private: | 306 private: |
296 class GetClientDocumentsCallback; | 307 class GetClientDocumentsCallback; |
297 | 308 |
298 friend class base::RefCounted<ServiceWorkerVersion>; | 309 friend class base::RefCounted<ServiceWorkerVersion>; |
299 friend class ServiceWorkerURLRequestJobTest; | 310 friend class ServiceWorkerURLRequestJobTest; |
300 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 311 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
301 ActivateWaitingVersion); | 312 ActivateWaitingVersion); |
302 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); | 313 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ScheduleStopWorker); |
303 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); | 314 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, KeepAlive); |
304 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); | 315 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest, ListenerAvailability); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 ControlleeMap controllee_map_; | 413 ControlleeMap controllee_map_; |
403 ControlleeByIDMap controllee_by_id_; | 414 ControlleeByIDMap controllee_by_id_; |
404 base::WeakPtr<ServiceWorkerContextCore> context_; | 415 base::WeakPtr<ServiceWorkerContextCore> context_; |
405 ObserverList<Listener> listeners_; | 416 ObserverList<Listener> listeners_; |
406 ServiceWorkerScriptCacheMap script_cache_map_; | 417 ServiceWorkerScriptCacheMap script_cache_map_; |
407 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; | 418 base::OneShotTimer<ServiceWorkerVersion> stop_worker_timer_; |
408 base::OneShotTimer<ServiceWorkerVersion> update_timer_; | 419 base::OneShotTimer<ServiceWorkerVersion> update_timer_; |
409 bool is_doomed_; | 420 bool is_doomed_; |
410 std::vector<int> pending_skip_waiting_requests_; | 421 std::vector<int> pending_skip_waiting_requests_; |
411 bool skip_waiting_; | 422 bool skip_waiting_; |
| 423 scoped_ptr<net::HttpResponseInfo> main_script_http_info_; |
412 | 424 |
413 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 425 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
414 | 426 |
415 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 427 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
416 }; | 428 }; |
417 | 429 |
418 } // namespace content | 430 } // namespace content |
419 | 431 |
420 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 432 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |