| 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/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/bind.h" | 13 #include "base/bind.h" |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 20 #include "components/mime_util/mime_util.h" | 21 #include "components/mime_util/mime_util.h" |
| 21 #include "components/scheduler/child/web_task_runner_impl.h" | 22 #include "components/scheduler/child/web_task_runner_impl.h" |
| 22 #include "content/child/child_thread_impl.h" | 23 #include "content/child/child_thread_impl.h" |
| 23 #include "content/child/ftp_directory_listing_response_delegate.h" | 24 #include "content/child/ftp_directory_listing_response_delegate.h" |
| 24 #include "content/child/multipart_response_delegate.h" | 25 #include "content/child/multipart_response_delegate.h" |
| 25 #include "content/child/request_extra_data.h" | 26 #include "content/child/request_extra_data.h" |
| 26 #include "content/child/request_info.h" | 27 #include "content/child/request_info.h" |
| 27 #include "content/child/resource_dispatcher.h" | 28 #include "content/child/resource_dispatcher.h" |
| 28 #include "content/child/shared_memory_data_consumer_handle.h" | 29 #include "content/child/shared_memory_data_consumer_handle.h" |
| 29 #include "content/child/sync_load_response.h" | 30 #include "content/child/sync_load_response.h" |
| 30 #include "content/child/web_url_request_util.h" | 31 #include "content/child/web_url_request_util.h" |
| 31 #include "content/child/weburlresponse_extradata_impl.h" | 32 #include "content/child/weburlresponse_extradata_impl.h" |
| 32 #include "content/common/resource_messages.h" | 33 #include "content/common/resource_messages.h" |
| 33 #include "content/common/resource_request_body.h" | 34 #include "content/common/resource_request_body.h" |
| 34 #include "content/common/service_worker/service_worker_types.h" | 35 #include "content/common/service_worker/service_worker_types.h" |
| 35 #include "content/common/ssl_status_serialization.h" | 36 #include "content/common/ssl_status_serialization.h" |
| 36 #include "content/public/child/fixed_received_data.h" | 37 #include "content/public/child/fixed_received_data.h" |
| 37 #include "content/public/child/request_peer.h" | 38 #include "content/public/child/request_peer.h" |
| 38 #include "content/public/common/browser_side_navigation_policy.h" | 39 #include "content/public/common/browser_side_navigation_policy.h" |
| 40 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" |
| 41 #include "content/public/common/ssl_status.h" |
| 39 #include "net/base/data_url.h" | 42 #include "net/base/data_url.h" |
| 40 #include "net/base/filename_util.h" | 43 #include "net/base/filename_util.h" |
| 41 #include "net/base/net_errors.h" | 44 #include "net/base/net_errors.h" |
| 45 #include "net/cert/cert_status_flags.h" |
| 46 #include "net/cert/sct_status_flags.h" |
| 42 #include "net/http/http_response_headers.h" | 47 #include "net/http/http_response_headers.h" |
| 43 #include "net/http/http_util.h" | 48 #include "net/http/http_util.h" |
| 44 #include "net/ssl/ssl_cipher_suite_names.h" | 49 #include "net/ssl/ssl_cipher_suite_names.h" |
| 45 #include "net/ssl/ssl_connection_status_flags.h" | 50 #include "net/ssl/ssl_connection_status_flags.h" |
| 46 #include "net/url_request/url_request_data_job.h" | 51 #include "net/url_request/url_request_data_job.h" |
| 47 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" | 52 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" |
| 48 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 53 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 49 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 54 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 50 #include "third_party/WebKit/public/platform/WebURL.h" | 55 #include "third_party/WebKit/public/platform/WebURL.h" |
| 51 #include "third_party/WebKit/public/platform/WebURLError.h" | 56 #include "third_party/WebKit/public/platform/WebURLError.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 case SECURITY_STYLE_WARNING: | 235 case SECURITY_STYLE_WARNING: |
| 231 securityStyle = WebURLResponse::SecurityStyleWarning; | 236 securityStyle = WebURLResponse::SecurityStyleWarning; |
| 232 break; | 237 break; |
| 233 case SECURITY_STYLE_AUTHENTICATED: | 238 case SECURITY_STYLE_AUTHENTICATED: |
| 234 securityStyle = WebURLResponse::SecurityStyleAuthenticated; | 239 securityStyle = WebURLResponse::SecurityStyleAuthenticated; |
| 235 break; | 240 break; |
| 236 } | 241 } |
| 237 | 242 |
| 238 response->setSecurityStyle(securityStyle); | 243 response->setSecurityStyle(securityStyle); |
| 239 | 244 |
| 240 blink::WebString protocol_string = blink::WebString::fromUTF8(protocol); | 245 SignedCertificateTimestampIDStatusList sct_list = |
| 241 blink::WebString cipher_string = blink::WebString::fromUTF8(cipher); | 246 ssl_status.signed_certificate_timestamp_ids; |
| 242 blink::WebString key_exchange_string = | 247 |
| 243 blink::WebString::fromUTF8(key_exchange); | 248 size_t num_unknown_scts = 0; |
| 244 blink::WebString mac_string = blink::WebString::fromUTF8(mac); | 249 size_t num_invalid_scts = 0; |
| 245 response->setSecurityDetails(protocol_string, key_exchange_string, | 250 size_t num_valid_scts = 0; |
| 246 cipher_string, mac_string, | 251 |
| 247 ssl_status.cert_id); | 252 SignedCertificateTimestampIDStatusList::iterator iter; |
| 253 for (iter = sct_list.begin(); iter < sct_list.end(); ++iter) { |
| 254 switch (iter->status) { |
| 255 case net::ct::SCT_STATUS_LOG_UNKNOWN: |
| 256 num_unknown_scts++; |
| 257 break; |
| 258 case net::ct::SCT_STATUS_INVALID: |
| 259 num_invalid_scts++; |
| 260 break; |
| 261 case net::ct::SCT_STATUS_OK: |
| 262 num_valid_scts++; |
| 263 break; |
| 264 case net::ct::SCT_STATUS_NONE: |
| 265 case net::ct::SCT_STATUS_MAX: |
| 266 // These enum values do not represent SCTs that are taken into account |
| 267 // for CT compliance calculations, so we ignore them. |
| 268 break; |
| 269 } |
| 270 } |
| 271 |
| 272 blink::WebURLResponse::WebSecurityDetails webSecurityDetails( |
| 273 WebString::fromUTF8(protocol), WebString::fromUTF8(cipher), |
| 274 WebString::fromUTF8(key_exchange), WebString::fromUTF8(mac), |
| 275 ssl_status.cert_id, num_unknown_scts, num_invalid_scts, num_valid_scts); |
| 276 |
| 277 response->setSecurityDetails(webSecurityDetails); |
| 248 } | 278 } |
| 249 | 279 |
| 250 } // namespace | 280 } // namespace |
| 251 | 281 |
| 252 // WebURLLoaderImpl::Context -------------------------------------------------- | 282 // WebURLLoaderImpl::Context -------------------------------------------------- |
| 253 | 283 |
| 254 // This inner class exists since the WebURLLoader may be deleted while inside a | 284 // This inner class exists since the WebURLLoader may be deleted while inside a |
| 255 // call to WebURLLoaderClient. Refcounting is to keep the context from being | 285 // call to WebURLLoaderClient. Refcounting is to keep the context from being |
| 256 // deleted if it may have work to do after calling into the client. | 286 // deleted if it may have work to do after calling into the client. |
| 257 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, | 287 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 } | 1124 } |
| 1095 | 1125 |
| 1096 void WebURLLoaderImpl::setLoadingTaskRunner( | 1126 void WebURLLoaderImpl::setLoadingTaskRunner( |
| 1097 blink::WebTaskRunner* loading_task_runner) { | 1127 blink::WebTaskRunner* loading_task_runner) { |
| 1098 // There's no guarantee on the lifetime of |loading_task_runner| so we take a | 1128 // There's no guarantee on the lifetime of |loading_task_runner| so we take a |
| 1099 // copy. | 1129 // copy. |
| 1100 context_->SetWebTaskRunner(make_scoped_ptr(loading_task_runner->clone())); | 1130 context_->SetWebTaskRunner(make_scoped_ptr(loading_task_runner->clone())); |
| 1101 } | 1131 } |
| 1102 | 1132 |
| 1103 } // namespace content | 1133 } // namespace content |
| OLD | NEW |