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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 class CONTENT_EXPORT ServiceWorkerURLRequestJob | 32 class CONTENT_EXPORT ServiceWorkerURLRequestJob |
33 : public net::URLRequestJob, | 33 : public net::URLRequestJob, |
34 public net::URLRequest::Delegate { | 34 public net::URLRequest::Delegate { |
35 public: | 35 public: |
36 ServiceWorkerURLRequestJob( | 36 ServiceWorkerURLRequestJob( |
37 net::URLRequest* request, | 37 net::URLRequest* request, |
38 net::NetworkDelegate* network_delegate, | 38 net::NetworkDelegate* network_delegate, |
39 base::WeakPtr<ServiceWorkerProviderHost> provider_host, | 39 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
40 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 40 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
41 FetchRequestMode request_mode, | 41 FetchRequestMode request_mode, |
| 42 FetchCredentialsMode credentials_mode, |
42 scoped_refptr<ResourceRequestBody> body); | 43 scoped_refptr<ResourceRequestBody> body); |
43 | 44 |
44 // Sets the response type. | 45 // Sets the response type. |
45 void FallbackToNetwork(); | 46 void FallbackToNetwork(); |
46 void ForwardToServiceWorker(); | 47 void ForwardToServiceWorker(); |
47 | 48 |
48 bool ShouldFallbackToNetwork() const { | 49 bool ShouldFallbackToNetwork() const { |
49 return response_type_ == FALLBACK_TO_NETWORK; | 50 return response_type_ == FALLBACK_TO_NETWORK; |
50 } | 51 } |
51 bool ShouldForwardToServiceWorker() const { | 52 bool ShouldForwardToServiceWorker() const { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_ptr<net::HttpResponseInfo> http_response_info_; | 155 scoped_ptr<net::HttpResponseInfo> http_response_info_; |
155 // Headers that have not yet been committed to |http_response_info_|. | 156 // Headers that have not yet been committed to |http_response_info_|. |
156 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; | 157 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; |
157 GURL response_url_; | 158 GURL response_url_; |
158 | 159 |
159 // Used when response type is FORWARD_TO_SERVICE_WORKER. | 160 // Used when response type is FORWARD_TO_SERVICE_WORKER. |
160 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; | 161 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; |
161 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 162 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
162 scoped_ptr<net::URLRequest> blob_request_; | 163 scoped_ptr<net::URLRequest> blob_request_; |
163 FetchRequestMode request_mode_; | 164 FetchRequestMode request_mode_; |
| 165 FetchCredentialsMode credentials_mode_; |
164 bool fall_back_required_; | 166 bool fall_back_required_; |
165 // ResourceRequestBody has a collection of BlobDataHandles attached to it | 167 // ResourceRequestBody has a collection of BlobDataHandles attached to it |
166 // using the userdata mechanism. So we have to keep it not to free the blobs. | 168 // using the userdata mechanism. So we have to keep it not to free the blobs. |
167 scoped_refptr<ResourceRequestBody> body_; | 169 scoped_refptr<ResourceRequestBody> body_; |
168 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; | 170 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; |
169 | 171 |
170 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 172 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
171 | 173 |
172 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 174 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
173 }; | 175 }; |
174 | 176 |
175 } // namespace content | 177 } // namespace content |
176 | 178 |
177 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 179 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
OLD | NEW |