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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return nullptr; | 153 return nullptr; |
154 } | 154 } |
155 | 155 |
156 // It's for original request (A) or redirect case (B-a or B-b). | 156 // It's for original request (A) or redirect case (B-a or B-b). |
157 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker()); | 157 DCHECK(!job_.get() || job_->ShouldForwardToServiceWorker()); |
158 | 158 |
159 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob( | 159 ServiceWorkerURLRequestJob* job = new ServiceWorkerURLRequestJob( |
160 request, network_delegate, std::string(), blob_storage_context_, | 160 request, network_delegate, std::string(), blob_storage_context_, |
161 resource_context, request_mode_, credentials_mode_, redirect_mode_, | 161 resource_context, request_mode_, credentials_mode_, redirect_mode_, |
162 resource_type_, request_context_type_, frame_type_, body_, | 162 resource_type_, request_context_type_, frame_type_, body_, |
163 ServiceWorkerFetchType::FOREIGN_FETCH, MojoURLLoaderFactoryGetter(), | 163 ServiceWorkerFetchType::FOREIGN_FETCH, this); |
164 this); | |
165 job_ = job->GetWeakPtr(); | 164 job_ = job->GetWeakPtr(); |
166 resource_context_ = resource_context; | 165 resource_context_ = resource_context; |
167 | 166 |
168 context_->FindReadyRegistrationForDocument( | 167 context_->FindReadyRegistrationForDocument( |
169 request->url(), | 168 request->url(), |
170 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, | 169 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, |
171 weak_factory_.GetWeakPtr(), job_)); | 170 weak_factory_.GetWeakPtr(), job_)); |
172 | 171 |
173 return job_.get(); | 172 return job_.get(); |
174 } | 173 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return target_worker_.get(); | 265 return target_worker_.get(); |
267 } | 266 } |
268 | 267 |
269 void ForeignFetchRequestHandler::ClearJob() { | 268 void ForeignFetchRequestHandler::ClearJob() { |
270 job_.reset(); | 269 job_.reset(); |
271 target_worker_ = nullptr; | 270 target_worker_ = nullptr; |
272 resource_context_ = nullptr; | 271 resource_context_ = nullptr; |
273 } | 272 } |
274 | 273 |
275 } // namespace content | 274 } // namespace content |
OLD | NEW |