OLD | NEW |
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 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 5 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
6 | 6 |
7 #include "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
8 #include "content/browser/service_worker/service_worker_metrics.h" | 8 #include "content/browser/service_worker/service_worker_metrics.h" |
9 #include "content/browser/service_worker/service_worker_provider_host.h" | 9 #include "content/browser/service_worker/service_worker_provider_host.h" |
10 #include "content/browser/service_worker/service_worker_registration.h" | 10 #include "content/browser/service_worker/service_worker_registration.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // If we know we can fallback to network at this point (in case | 89 // If we know we can fallback to network at this point (in case |
90 // the storage lookup returned immediately), just return NULL here to | 90 // the storage lookup returned immediately), just return NULL here to |
91 // fallback to network. | 91 // fallback to network. |
92 job_ = NULL; | 92 job_ = NULL; |
93 return NULL; | 93 return NULL; |
94 } | 94 } |
95 | 95 |
96 return job_.get(); | 96 return job_.get(); |
97 } | 97 } |
98 | 98 |
| 99 void ServiceWorkerControlleeRequestHandler::GetExtraResponseInfo( |
| 100 bool* was_fetched_via_service_worker, |
| 101 GURL* original_url_via_service_worker) const { |
| 102 if (!job_) { |
| 103 *was_fetched_via_service_worker = false; |
| 104 *original_url_via_service_worker = GURL(); |
| 105 return; |
| 106 } |
| 107 job_->GetExtraResponseInfo(was_fetched_via_service_worker, |
| 108 original_url_via_service_worker); |
| 109 } |
| 110 |
99 void ServiceWorkerControlleeRequestHandler::PrepareForMainResource( | 111 void ServiceWorkerControlleeRequestHandler::PrepareForMainResource( |
100 const GURL& url) { | 112 const GURL& url) { |
101 DCHECK(job_.get()); | 113 DCHECK(job_.get()); |
102 DCHECK(context_); | 114 DCHECK(context_); |
103 // The corresponding provider_host may already have associate version in | 115 // The corresponding provider_host may already have associate version in |
104 // redirect case, unassociate it now. | 116 // redirect case, unassociate it now. |
105 provider_host_->UnsetVersion(NULL); | 117 provider_host_->UnsetVersion(NULL); |
106 | 118 |
107 GURL stripped_url = net::SimplifyUrlForRequest(url); | 119 GURL stripped_url = net::SimplifyUrlForRequest(url); |
108 provider_host_->SetDocumentUrl(stripped_url); | 120 provider_host_->SetDocumentUrl(stripped_url); |
(...skipping 27 matching lines...) Expand all Loading... |
136 } | 148 } |
137 | 149 |
138 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { | 150 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { |
139 DCHECK(job_.get()); | 151 DCHECK(job_.get()); |
140 DCHECK(context_); | 152 DCHECK(context_); |
141 DCHECK(provider_host_->active_version()); | 153 DCHECK(provider_host_->active_version()); |
142 job_->ForwardToServiceWorker(); | 154 job_->ForwardToServiceWorker(); |
143 } | 155 } |
144 | 156 |
145 } // namespace content | 157 } // namespace content |
OLD | NEW |