OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "content/browser/service_worker/foreign_fetch_request_handler.h" | 5 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return nullptr; | 152 return nullptr; |
153 } | 153 } |
154 | 154 |
155 // It's for original request (A) or redirect case (B-a or B-b). | 155 // It's for original request (A) or redirect case (B-a or B-b). |
156 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker()); | 156 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker()); |
157 | 157 |
158 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob( | 158 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob( |
159 request, network_delegate, std::string(), blob_storage_context_, | 159 request, network_delegate, std::string(), blob_storage_context_, |
160 resource_context, request_mode_, credentials_mode_, redirect_mode_, | 160 resource_context, request_mode_, credentials_mode_, redirect_mode_, |
161 resource_type_, request_context_type_, frame_type_, body_, | 161 resource_type_, request_context_type_, frame_type_, body_, |
162 ServiceWorkerFetchType::FOREIGN_FETCH, this); | 162 ServiceWorkerFetchType::FOREIGN_FETCH, |
| 163 ServiceWorkerURLRequestJob::URLLoaderFactoryCallback(), this); |
163 job_ = job->GetWeakPtr(); | 164 job_ = job->GetWeakPtr(); |
164 resource_context_ = resource_context; | 165 resource_context_ = resource_context; |
165 | 166 |
166 context_->FindReadyRegistrationForDocument( | 167 context_->FindReadyRegistrationForDocument( |
167 request->url(), | 168 request->url(), |
168 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, | 169 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, |
169 weak_factory_.GetWeakPtr(), job_)); | 170 weak_factory_.GetWeakPtr(), job_)); |
170 | 171 |
171 return job_.get(); | 172 return job_.get(); |
172 } | 173 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 return target_worker_.get(); | 265 return target_worker_.get(); |
265 } | 266 } |
266 | 267 |
267 void ForeignFetchRequestHandler::ClearJob() { | 268 void ForeignFetchRequestHandler::ClearJob() { |
268 job_.reset(); | 269 job_.reset(); |
269 target_worker_ = nullptr; | 270 target_worker_ = nullptr; |
270 resource_context_ = nullptr; | 271 resource_context_ = nullptr; |
271 } | 272 } |
272 | 273 |
273 } // namespace content | 274 } // namespace content |
OLD | NEW |