Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job.h

Issue 623663002: [ServiceWorker] pipe RequestContext and FrameType to ServiceWorker. [2/2 chromium] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: request_info.cc Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "content/common/service_worker/service_worker_status_code.h" 14 #include "content/common/service_worker/service_worker_status_code.h"
15 #include "content/common/service_worker/service_worker_types.h" 15 #include "content/common/service_worker/service_worker_types.h"
16 #include "content/public/common/request_context_frame_type.h"
17 #include "content/public/common/request_context_type.h"
18 #include "content/public/common/resource_type.h"
16 #include "net/http/http_byte_range.h" 19 #include "net/http/http_byte_range.h"
17 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_job.h" 21 #include "net/url_request/url_request_job.h"
19 22
20 namespace storage { 23 namespace storage {
21 class BlobDataHandle; 24 class BlobDataHandle;
22 class BlobStorageContext; 25 class BlobStorageContext;
23 } 26 }
24 27
25 namespace content { 28 namespace content {
26 29
27 class ResourceRequestBody; 30 class ResourceRequestBody;
28 class ServiceWorkerContextCore; 31 class ServiceWorkerContextCore;
29 class ServiceWorkerFetchDispatcher; 32 class ServiceWorkerFetchDispatcher;
30 class ServiceWorkerProviderHost; 33 class ServiceWorkerProviderHost;
31 34
32 class CONTENT_EXPORT ServiceWorkerURLRequestJob 35 class CONTENT_EXPORT ServiceWorkerURLRequestJob
33 : public net::URLRequestJob, 36 : public net::URLRequestJob,
34 public net::URLRequest::Delegate { 37 public net::URLRequest::Delegate {
35 public: 38 public:
36 ServiceWorkerURLRequestJob( 39 ServiceWorkerURLRequestJob(
37 net::URLRequest* request, 40 net::URLRequest* request,
38 net::NetworkDelegate* network_delegate, 41 net::NetworkDelegate* network_delegate,
39 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 42 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
40 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, 43 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
41 FetchRequestMode request_mode, 44 FetchRequestMode request_mode,
42 FetchCredentialsMode credentials_mode, 45 FetchCredentialsMode credentials_mode,
46 RequestContextType request_context_type,
47 RequestContextFrameType frame_type,
43 scoped_refptr<ResourceRequestBody> body); 48 scoped_refptr<ResourceRequestBody> body);
44 49
45 // Sets the response type. 50 // Sets the response type.
46 void FallbackToNetwork(); 51 void FallbackToNetwork();
47 void ForwardToServiceWorker(); 52 void ForwardToServiceWorker();
48 53
49 bool ShouldFallbackToNetwork() const { 54 bool ShouldFallbackToNetwork() const {
50 return response_type_ == FALLBACK_TO_NETWORK; 55 return response_type_ == FALLBACK_TO_NETWORK;
51 } 56 }
52 bool ShouldForwardToServiceWorker() const { 57 bool ShouldForwardToServiceWorker() const {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Headers that have not yet been committed to |http_response_info_|. 161 // Headers that have not yet been committed to |http_response_info_|.
157 scoped_refptr<net::HttpResponseHeaders> http_response_headers_; 162 scoped_refptr<net::HttpResponseHeaders> http_response_headers_;
158 GURL response_url_; 163 GURL response_url_;
159 164
160 // Used when response type is FORWARD_TO_SERVICE_WORKER. 165 // Used when response type is FORWARD_TO_SERVICE_WORKER.
161 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_; 166 scoped_ptr<ServiceWorkerFetchDispatcher> fetch_dispatcher_;
162 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; 167 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
163 scoped_ptr<net::URLRequest> blob_request_; 168 scoped_ptr<net::URLRequest> blob_request_;
164 FetchRequestMode request_mode_; 169 FetchRequestMode request_mode_;
165 FetchCredentialsMode credentials_mode_; 170 FetchCredentialsMode credentials_mode_;
171 RequestContextType request_context_type_;
172 RequestContextFrameType frame_type_;
166 bool fall_back_required_; 173 bool fall_back_required_;
167 // ResourceRequestBody has a collection of BlobDataHandles attached to it 174 // ResourceRequestBody has a collection of BlobDataHandles attached to it
168 // using the userdata mechanism. So we have to keep it not to free the blobs. 175 // using the userdata mechanism. So we have to keep it not to free the blobs.
169 scoped_refptr<ResourceRequestBody> body_; 176 scoped_refptr<ResourceRequestBody> body_;
170 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_; 177 scoped_ptr<storage::BlobDataHandle> request_body_blob_data_handle_;
171 178
172 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_; 179 base::WeakPtrFactory<ServiceWorkerURLRequestJob> weak_factory_;
173 180
174 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob); 181 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerURLRequestJob);
175 }; 182 };
176 183
177 } // namespace content 184 } // namespace content
178 185
179 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_ 186 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_URL_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698