| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 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 scoped_refptr<ResourceRequestBody> body); | 42 scoped_refptr<ResourceRequestBody> body); |
| 42 | 43 |
| 43 // Sets the response type. | 44 // Sets the response type. |
| 44 void FallbackToNetwork(); | 45 void FallbackToNetwork(); |
| 45 void ForwardToServiceWorker(); | 46 void ForwardToServiceWorker(); |
| 46 | 47 |
| 47 bool ShouldFallbackToNetwork() const { | 48 bool ShouldFallbackToNetwork() const { |
| 48 return response_type_ == FALLBACK_TO_NETWORK; | 49 return response_type_ == FALLBACK_TO_NETWORK; |
| 49 } | 50 } |
| 50 bool ShouldForwardToServiceWorker() const { | 51 bool ShouldForwardToServiceWorker() const { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 scoped_ptr<net::HttpResponseInfo> range_response_info_; | 152 scoped_ptr<net::HttpResponseInfo> range_response_info_; |
| 152 scoped_ptr<net::HttpResponseInfo> http_response_info_; | 153 scoped_ptr<net::HttpResponseInfo> http_response_info_; |
| 153 // Headers that have not yet been committed to |http_response_info_|. | 154 // Headers that have not yet been committed to |http_response_info_|. |
| 154 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; | 155 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; |
| 155 GURL response_url_; | 156 GURL response_url_; |
| 156 | 157 |
| 157 // Used when response type is FORWARD_TO_SERVICE_WORKER. | 158 // Used when response type is FORWARD_TO_SERVICE_WORKER. |
| 158 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; | 159 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; |
| 159 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 160 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
| 160 scoped_ptr<net::URLRequest> blob_request_; | 161 scoped_ptr<net::URLRequest> blob_request_; |
| 162 FetchRequestMode request_mode_; |
| 161 // ResourceRequestBody has a collection of BlobDataHandles attached to it | 163 // ResourceRequestBody has a collection of BlobDataHandles attached to it |
| 162 // using the userdata mechanism. So we have to keep it not to free the blobs. | 164 // using the userdata mechanism. So we have to keep it not to free the blobs. |
| 163 scoped_refptr<ResourceRequestBody> body_; | 165 scoped_refptr<ResourceRequestBody> body_; |
| 164 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; | 166 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; |
| 165 | 167 |
| 166 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; | 168 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; |
| 167 | 169 |
| 168 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); | 170 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); |
| 169 }; | 171 }; |
| 170 | 172 |
| 171 } // namespace content | 173 } // namespace content |
| 172 | 174 |
| 173 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ | 175 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ |
| OLD | NEW |