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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (use_network_) { | 150 if (use_network_) { |
151 // TODO(mek): Determine if redirects should be able to be intercepted by | 151 // TODO(mek): Determine if redirects should be able to be intercepted by |
152 // other foreign fetch service workers. | 152 // other foreign fetch service workers. |
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, base::WeakPtr<ServiceWorkerProviderHost>(), |
161 resource_context, request_mode_, credentials_mode_, redirect_mode_, | 161 blob_storage_context_, resource_context, request_mode_, credentials_mode_, |
162 resource_type_, request_context_type_, frame_type_, body_, | 162 redirect_mode_, resource_type_, request_context_type_, frame_type_, body_, |
163 ServiceWorkerFetchType::FOREIGN_FETCH, this); | 163 ServiceWorkerFetchType::FOREIGN_FETCH, this); |
164 job_ = job->GetWeakPtr(); | 164 job_ = job->GetWeakPtr(); |
165 resource_context_ = resource_context; | 165 resource_context_ = resource_context; |
166 | 166 |
167 context_->FindReadyRegistrationForDocument( | 167 context_->FindReadyRegistrationForDocument( |
168 request->url(), | 168 request->url(), |
169 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, | 169 base::Bind(&ForeignFetchRequestHandler::DidFindRegistration, |
170 weak_factory_.GetWeakPtr(), job_)); | 170 weak_factory_.GetWeakPtr(), job_)); |
171 | 171 |
172 return job_.get(); | 172 return job_.get(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 return target_worker_.get(); | 265 return target_worker_.get(); |
266 } | 266 } |
267 | 267 |
268 void ForeignFetchRequestHandler::ClearJob() { | 268 void ForeignFetchRequestHandler::ClearJob() { |
269 job_.reset(); | 269 job_.reset(); |
270 target_worker_ = nullptr; | 270 target_worker_ = nullptr; |
271 resource_context_ = nullptr; | 271 resource_context_ = nullptr; |
272 } | 272 } |
273 | 273 |
274 } // namespace content | 274 } // namespace content |
OLD | NEW |