| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_url_loader_job.h" | 5 #include "content/browser/service_worker/service_worker_url_loader_job.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "content/browser/blob_storage/blob_url_loader_factory.h" | 8 #include "content/browser/blob_storage/blob_url_loader_factory.h" |
| 9 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" | 9 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" |
| 10 #include "content/browser/service_worker/service_worker_version.h" | 10 #include "content/browser/service_worker/service_worker_version.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 DeliverErrorResponse(); | 244 DeliverErrorResponse(); |
| 245 return; | 245 return; |
| 246 } | 246 } |
| 247 | 247 |
| 248 // Creates a new HttpResponseInfo using the the ServiceWorker script's | 248 // Creates a new HttpResponseInfo using the the ServiceWorker script's |
| 249 // HttpResponseInfo to show HTTPS padlock. | 249 // HttpResponseInfo to show HTTPS padlock. |
| 250 // TODO(horo): When we support mixed-content (HTTP) no-cors requests from a | 250 // TODO(horo): When we support mixed-content (HTTP) no-cors requests from a |
| 251 // ServiceWorker, we have to check the security level of the responses. | 251 // ServiceWorker, we have to check the security level of the responses. |
| 252 const net::HttpResponseInfo* main_script_http_info = | 252 const net::HttpResponseInfo* main_script_http_info = |
| 253 version->GetMainScriptHttpResponseInfo(); | 253 version->GetMainScriptHttpResponseInfo(); |
| 254 DCHECK(main_script_http_info); | 254 // TODO(kinuko) |
| 255 ssl_info_ = main_script_http_info->ssl_info; | 255 // Fix this here. |
| 256 if (main_script_http_info) |
| 257 ssl_info_ = main_script_http_info->ssl_info; |
| 256 | 258 |
| 257 std::move(loader_callback_) | 259 std::move(loader_callback_) |
| 258 .Run(base::Bind(&ServiceWorkerURLLoaderJob::StartResponse, | 260 .Run(base::Bind(&ServiceWorkerURLLoaderJob::StartResponse, |
| 259 weak_factory_.GetWeakPtr(), response, | 261 weak_factory_.GetWeakPtr(), response, |
| 260 base::Passed(std::move(body_as_stream)))); | 262 base::Passed(std::move(body_as_stream)))); |
| 261 } | 263 } |
| 262 | 264 |
| 263 void ServiceWorkerURLLoaderJob::StartResponse( | 265 void ServiceWorkerURLLoaderJob::StartResponse( |
| 264 const ServiceWorkerResponse& response, | 266 const ServiceWorkerResponse& response, |
| 265 blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, | 267 blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 359 } |
| 358 | 360 |
| 359 void ServiceWorkerURLLoaderJob::OnComplete( | 361 void ServiceWorkerURLLoaderJob::OnComplete( |
| 360 const ResourceRequestCompletionStatus& status) { | 362 const ResourceRequestCompletionStatus& status) { |
| 361 DCHECK_EQ(Status::kSentHeader, status_); | 363 DCHECK_EQ(Status::kSentHeader, status_); |
| 362 status_ = Status::kCompleted; | 364 status_ = Status::kCompleted; |
| 363 url_loader_client_->OnComplete(status); | 365 url_loader_client_->OnComplete(status); |
| 364 } | 366 } |
| 365 | 367 |
| 366 } // namespace content | 368 } // namespace content |
| OLD | NEW |