| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "content/browser/service_worker/embedded_worker_status.h" | 18 #include "content/browser/service_worker/embedded_worker_status.h" |
| 19 #include "content/browser/service_worker/service_worker_metrics.h" | 19 #include "content/browser/service_worker/service_worker_metrics.h" |
| 20 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 20 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
| 21 #include "content/common/service_worker/service_worker_status_code.h" | 22 #include "content/common/service_worker/service_worker_status_code.h" |
| 22 #include "content/common/service_worker/service_worker_types.h" | 23 #include "content/common/service_worker/service_worker_types.h" |
| 23 #include "content/public/common/request_context_frame_type.h" | 24 #include "content/public/common/request_context_frame_type.h" |
| 24 #include "content/public/common/request_context_type.h" | 25 #include "content/public/common/request_context_type.h" |
| 25 #include "content/public/common/resource_type.h" | 26 #include "content/public/common/resource_type.h" |
| 26 #include "net/http/http_byte_range.h" | 27 #include "net/http/http_byte_range.h" |
| 27 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
| 28 #include "net/url_request/url_request_job.h" | 29 #include "net/url_request/url_request_job.h" |
| 29 #include "net/url_request/url_request_status.h" | 30 #include "net/url_request/url_request_status.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ServiceWorkerMetrics::URLRequestJobResult* result); | 78 ServiceWorkerMetrics::URLRequestJobResult* result); |
| 78 | 79 |
| 79 // Called to signal that loading failed, and that the resource being loaded | 80 // Called to signal that loading failed, and that the resource being loaded |
| 80 // was a main resource. | 81 // was a main resource. |
| 81 virtual void MainResourceLoadFailed() {} | 82 virtual void MainResourceLoadFailed() {} |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 ServiceWorkerURLRequestJob( | 85 ServiceWorkerURLRequestJob( |
| 85 net::URLRequest* request, | 86 net::URLRequest* request, |
| 86 net::NetworkDelegate* network_delegate, | 87 net::NetworkDelegate* network_delegate, |
| 87 const std::string& client_id, | 88 base::WeakPtr<ServiceWorkerProviderHost> client_provider_host, |
| 88 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 89 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 89 const ResourceContext* resource_context, | 90 const ResourceContext* resource_context, |
| 90 FetchRequestMode request_mode, | 91 FetchRequestMode request_mode, |
| 91 FetchCredentialsMode credentials_mode, | 92 FetchCredentialsMode credentials_mode, |
| 92 FetchRedirectMode redirect_mode, | 93 FetchRedirectMode redirect_mode, |
| 93 ResourceType resource_type, | 94 ResourceType resource_type, |
| 94 RequestContextType request_context_type, | 95 RequestContextType request_context_type, |
| 95 RequestContextFrameType frame_type, | 96 RequestContextFrameType frame_type, |
| 96 scoped_refptr<ResourceRequestBodyImpl> body, | 97 scoped_refptr<ResourceRequestBodyImpl> body, |
| 97 ServiceWorkerFetchType fetch_type, | 98 ServiceWorkerFetchType fetch_type, |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 net::HttpByteRange byte_range_; | 245 net::HttpByteRange byte_range_; |
| 245 std::unique_ptr<net::HttpResponseInfo> range_response_info_; | 246 std::unique_ptr<net::HttpResponseInfo> range_response_info_; |
| 246 std::unique_ptr<net::HttpResponseInfo> http_response_info_; | 247 std::unique_ptr<net::HttpResponseInfo> http_response_info_; |
| 247 // Headers that have not yet been committed to |http_response_info_|. | 248 // Headers that have not yet been committed to |http_response_info_|. |
| 248 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; | 249 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; |
| 249 GURL response_url_; | 250 GURL response_url_; |
| 250 blink::WebServiceWorkerResponseType service_worker_response_type_; | 251 blink::WebServiceWorkerResponseType service_worker_response_type_; |
| 251 | 252 |
| 252 // Used when response type is FORWARD_TO_SERVICE_WORKER. | 253 // Used when response type is FORWARD_TO_SERVICE_WORKER. |
| 253 std::unique_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; | 254 std::unique_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; |
| 255 base::WeakPtr<ServiceWorkerProviderHost> client_provider_host_; |
| 254 std::string client_id_; | 256 std::string client_id_; |
| 255 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 257 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
| 256 const ResourceContext* resource_context_; | 258 const ResourceContext* resource_context_; |
| 257 // Only one of |blob_reader_| and |stream_reader_| can be non-null. | 259 // Only one of |blob_reader_| and |stream_reader_| can be non-null. |
| 258 std::unique_ptr<ServiceWorkerBlobReader> blob_reader_; | 260 std::unique_ptr<ServiceWorkerBlobReader> blob_reader_; |
| 259 std::unique_ptr<ServiceWorkerStreamReader> stream_reader_; | 261 std::unique_ptr<ServiceWorkerStreamReader> stream_reader_; |
| 260 | 262 |
| 261 FetchRequestMode request_mode_; | 263 FetchRequestMode request_mode_; |
| 262 FetchCredentialsMode credentials_mode_; | 264 FetchCredentialsMode credentials_mode_; |
| 263 FetchRedirectMode redirect_mode_; | 265 FetchRedirectMode redirect_mode_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 285 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; | 287 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; |
| 286 | 288 |
| 287 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 289 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
| 288 | 290 |
| 289 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 291 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
| 290 }; | 292 }; |
| 291 | 293 |
| 292 } // namespace content | 294 } // namespace content |
| 293 | 295 |
| 294 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 296 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
| OLD | NEW |