| 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/renderer/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 return; | 255 return; |
| 256 client->OnNavigationPreloadError( | 256 client->OnNavigationPreloadError( |
| 257 fetch_event_id_, | 257 fetch_event_id_, |
| 258 base::MakeUnique<blink::WebServiceWorkerError>( | 258 base::MakeUnique<blink::WebServiceWorkerError>( |
| 259 blink::WebServiceWorkerError::ErrorTypeAbort, | 259 blink::WebServiceWorkerError::ErrorTypeAbort, |
| 260 blink::WebString::fromUTF8( | 260 blink::WebString::fromUTF8( |
| 261 "Service Worker navigation preload aborted. Need to guard with " | 261 "Service Worker navigation preload aborted. Need to guard with " |
| 262 "respondWith or waitUntil."))); | 262 "respondWith or waitUntil."))); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void OnReceiveResponse(const ResourceResponseHead& response_head) override { | 265 void OnReceiveResponse( |
| 266 const ResourceResponseHead& response_head, |
| 267 mojom::DownloadedTempFilePtr downloaded_file) override { |
| 266 DCHECK(!response_); | 268 DCHECK(!response_); |
| 269 DCHECK(!downloaded_file); |
| 267 response_ = base::MakeUnique<blink::WebServiceWorkerResponse>(); | 270 response_ = base::MakeUnique<blink::WebServiceWorkerResponse>(); |
| 268 response_->setURL(url_); | 271 response_->setURL(url_); |
| 269 DCHECK(response_head.headers); | 272 DCHECK(response_head.headers); |
| 270 response_->setStatus(response_head.headers->response_code()); | 273 response_->setStatus(response_head.headers->response_code()); |
| 271 response_->setStatusText( | 274 response_->setStatusText( |
| 272 blink::WebString::fromUTF8(response_head.headers->GetStatusText())); | 275 blink::WebString::fromUTF8(response_head.headers->GetStatusText())); |
| 273 response_->setResponseType(blink::WebServiceWorkerResponseTypeBasic); | 276 response_->setResponseType(blink::WebServiceWorkerResponseTypeBasic); |
| 274 size_t iter = 0; | 277 size_t iter = 0; |
| 275 std::string header_name; | 278 std::string header_name; |
| 276 std::string header_value; | 279 std::string header_value; |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 } | 1299 } |
| 1297 | 1300 |
| 1298 base::WeakPtr<ServiceWorkerContextClient> | 1301 base::WeakPtr<ServiceWorkerContextClient> |
| 1299 ServiceWorkerContextClient::GetWeakPtr() { | 1302 ServiceWorkerContextClient::GetWeakPtr() { |
| 1300 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 1303 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 1301 DCHECK(context_); | 1304 DCHECK(context_); |
| 1302 return context_->weak_factory.GetWeakPtr(); | 1305 return context_->weak_factory.GetWeakPtr(); |
| 1303 } | 1306 } |
| 1304 | 1307 |
| 1305 } // namespace content | 1308 } // namespace content |
| OLD | NEW |