| 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 public StreamRegisterObserver { | 56 public StreamRegisterObserver { |
| 57 public: | 57 public: |
| 58 class CONTENT_EXPORT Delegate { | 58 class CONTENT_EXPORT Delegate { |
| 59 public: | 59 public: |
| 60 virtual ~Delegate() {} | 60 virtual ~Delegate() {} |
| 61 | 61 |
| 62 // Will be invoked before the request is restarted. The caller | 62 // Will be invoked before the request is restarted. The caller |
| 63 // can use this opportunity to grab state from the | 63 // can use this opportunity to grab state from the |
| 64 // ServiceWorkerURLRequestJob to determine how it should behave when the | 64 // ServiceWorkerURLRequestJob to determine how it should behave when the |
| 65 // request is restarted. | 65 // request is restarted. |
| 66 virtual void OnPrepareToRestart( | 66 virtual void OnPrepareToRestart() = 0; |
| 67 base::TimeTicks service_worker_start_time, | |
| 68 base::TimeTicks service_worker_ready_time) = 0; | |
| 69 | |
| 70 // Called when the request has finished starting. | |
| 71 // Unlike URLRequestJob::NotifyComplete, called both on success and failure. | |
| 72 virtual void OnStartCompleted( | |
| 73 bool was_fetched_via_service_worker, | |
| 74 bool was_fallback_required, | |
| 75 const GURL& original_url_via_service_worker, | |
| 76 blink::WebServiceWorkerResponseType response_type_via_service_worker, | |
| 77 base::TimeTicks worker_start_time, | |
| 78 base::TimeTicks service_worker_ready_time, | |
| 79 bool response_is_in_cache_storage, | |
| 80 const std::string& response_cache_storage_cache_name) = 0; | |
| 81 | 67 |
| 82 // Returns the ServiceWorkerVersion fetch events for this request job should | 68 // Returns the ServiceWorkerVersion fetch events for this request job should |
| 83 // be dispatched to. If no appropriate worker can be determined, returns | 69 // be dispatched to. If no appropriate worker can be determined, returns |
| 84 // nullptr and sets |*result| to an appropriate error. | 70 // nullptr and sets |*result| to an appropriate error. |
| 85 virtual ServiceWorkerVersion* GetServiceWorkerVersion( | 71 virtual ServiceWorkerVersion* GetServiceWorkerVersion( |
| 86 ServiceWorkerMetrics::URLRequestJobResult* result) = 0; | 72 ServiceWorkerMetrics::URLRequestJobResult* result) = 0; |
| 87 | 73 |
| 88 // Called after dispatching the fetch event to determine if processing of | 74 // Called after dispatching the fetch event to determine if processing of |
| 89 // the request should still continue, or if processing should be aborted. | 75 // the request should still continue, or if processing should be aborted. |
| 90 // When false is returned, this sets |*result| to an appropriate error. | 76 // When false is returned, this sets |*result| to an appropriate error. |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 std::string response_cache_storage_cache_name_; | 269 std::string response_cache_storage_cache_name_; |
| 284 | 270 |
| 285 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 271 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
| 286 | 272 |
| 287 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 273 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
| 288 }; | 274 }; |
| 289 | 275 |
| 290 } // namespace content | 276 } // namespace content |
| 291 | 277 |
| 292 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 278 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
| OLD | NEW |