| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 10 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 credentials_mode_(credentials_mode), | 167 credentials_mode_(credentials_mode), |
| 168 redirect_mode_(redirect_mode), | 168 redirect_mode_(redirect_mode), |
| 169 request_context_type_(request_context_type), | 169 request_context_type_(request_context_type), |
| 170 frame_type_(frame_type), | 170 frame_type_(frame_type), |
| 171 body_(body), | 171 body_(body), |
| 172 weak_factory_(this) {} | 172 weak_factory_(this) {} |
| 173 | 173 |
| 174 void ForeignFetchRequestHandler::DidFindRegistration( | 174 void ForeignFetchRequestHandler::DidFindRegistration( |
| 175 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, | 175 const base::WeakPtr<ServiceWorkerURLRequestJob>& job, |
| 176 ServiceWorkerStatusCode status, | 176 ServiceWorkerStatusCode status, |
| 177 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 177 scoped_refptr<ServiceWorkerRegistration> registration) { |
| 178 if (!job || job.get() != job_.get()) { | 178 if (!job || job.get() != job_.get()) { |
| 179 // No more job to handle, or job changed somehow, so just return. | 179 // No more job to handle, or job changed somehow, so just return. |
| 180 return; | 180 return; |
| 181 } | 181 } |
| 182 | 182 |
| 183 if (status != SERVICE_WORKER_OK || !job->request()) { | 183 if (status != SERVICE_WORKER_OK || !job->request()) { |
| 184 job->FallbackToNetwork(); | 184 job->FallbackToNetwork(); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 228 } |
| 229 return target_worker_.get(); | 229 return target_worker_.get(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void ForeignFetchRequestHandler::ClearJob() { | 232 void ForeignFetchRequestHandler::ClearJob() { |
| 233 job_.reset(); | 233 job_.reset(); |
| 234 target_worker_ = nullptr; | 234 target_worker_ = nullptr; |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace content | 237 } // namespace content |
| OLD | NEW |