| 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/optional.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "content/browser/service_worker/embedded_worker_status.h" | 19 #include "content/browser/service_worker/embedded_worker_status.h" |
| 19 #include "content/browser/service_worker/service_worker_metrics.h" | 20 #include "content/browser/service_worker/service_worker_metrics.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" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 87 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
| 87 const ResourceContext* resource_context, | 88 const ResourceContext* resource_context, |
| 88 FetchRequestMode request_mode, | 89 FetchRequestMode request_mode, |
| 89 FetchCredentialsMode credentials_mode, | 90 FetchCredentialsMode credentials_mode, |
| 90 FetchRedirectMode redirect_mode, | 91 FetchRedirectMode redirect_mode, |
| 91 ResourceType resource_type, | 92 ResourceType resource_type, |
| 92 RequestContextType request_context_type, | 93 RequestContextType request_context_type, |
| 93 RequestContextFrameType frame_type, | 94 RequestContextFrameType frame_type, |
| 94 scoped_refptr<ResourceRequestBodyImpl> body, | 95 scoped_refptr<ResourceRequestBodyImpl> body, |
| 95 ServiceWorkerFetchType fetch_type, | 96 ServiceWorkerFetchType fetch_type, |
| 97 const base::Optional<base::TimeDelta>& timeout, |
| 96 Delegate* delegate); | 98 Delegate* delegate); |
| 97 | 99 |
| 98 ~ServiceWorkerURLRequestJob() override; | 100 ~ServiceWorkerURLRequestJob() override; |
| 99 | 101 |
| 100 const ResourceContext* resource_context() const { return resource_context_; } | 102 const ResourceContext* resource_context() const { return resource_context_; } |
| 101 | 103 |
| 102 // Sets the response type. | 104 // Sets the response type. |
| 103 // When an in-flight request possibly needs CORS check, use | 105 // When an in-flight request possibly needs CORS check, use |
| 104 // FallbackToNetworkOrRenderer. This method will decide whether the request | 106 // FallbackToNetworkOrRenderer. This method will decide whether the request |
| 105 // can directly go to the network or should fallback to a renderer to send | 107 // can directly go to the network or should fallback to a renderer to send |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 FetchRedirectMode redirect_mode_; | 264 FetchRedirectMode redirect_mode_; |
| 263 const ResourceType resource_type_; | 265 const ResourceType resource_type_; |
| 264 RequestContextType request_context_type_; | 266 RequestContextType request_context_type_; |
| 265 RequestContextFrameType frame_type_; | 267 RequestContextFrameType frame_type_; |
| 266 bool fall_back_required_; | 268 bool fall_back_required_; |
| 267 // ResourceRequestBody has a collection of BlobDataHandles attached to it | 269 // ResourceRequestBody has a collection of BlobDataHandles attached to it |
| 268 // using the userdata mechanism. So we have to keep it not to free the blobs. | 270 // using the userdata mechanism. So we have to keep it not to free the blobs. |
| 269 scoped_refptr<ResourceRequestBodyImpl> body_; | 271 scoped_refptr<ResourceRequestBodyImpl> body_; |
| 270 std::unique_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; | 272 std::unique_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; |
| 271 ServiceWorkerFetchType fetch_type_; | 273 ServiceWorkerFetchType fetch_type_; |
| 274 base::Optional<base::TimeDelta> timeout_; |
| 272 | 275 |
| 273 ResponseBodyType response_body_type_ = UNKNOWN; | 276 ResponseBodyType response_body_type_ = UNKNOWN; |
| 274 bool did_record_result_ = false; | 277 bool did_record_result_ = false; |
| 275 | 278 |
| 276 bool response_is_in_cache_storage_ = false; | 279 bool response_is_in_cache_storage_ = false; |
| 277 std::string response_cache_storage_cache_name_; | 280 std::string response_cache_storage_cache_name_; |
| 278 | 281 |
| 279 ServiceWorkerHeaderList cors_exposed_header_names_; | 282 ServiceWorkerHeaderList cors_exposed_header_names_; |
| 280 | 283 |
| 281 std::unique_ptr<FileSizeResolver> file_size_resolver_; | 284 std::unique_ptr<FileSizeResolver> file_size_resolver_; |
| 282 | 285 |
| 283 bool worker_already_activated_ = false; | 286 bool worker_already_activated_ = false; |
| 284 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; | 287 EmbeddedWorkerStatus initial_worker_status_ = EmbeddedWorkerStatus::STOPPED; |
| 285 | 288 |
| 286 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 289 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
| 287 | 290 |
| 288 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 291 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
| 289 }; | 292 }; |
| 290 | 293 |
| 291 } // namespace content | 294 } // namespace content |
| 292 | 295 |
| 293 #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 |