Chromium Code Reviews| 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 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // per-resource security styles should live in the same place as the | 94 // per-resource security styles should live in the same place as the |
| 95 // logic for assigning per-page security styles (which lives in the | 95 // logic for assigning per-page security styles (which lives in the |
| 96 // embedder). It would also be nice for the embedder to have the chance | 96 // embedder). It would also be nice for the embedder to have the chance |
| 97 // to control the per-resource security style beyond the simple logic | 97 // to control the per-resource security style beyond the simple logic |
| 98 // here. (For example, the embedder might want to mark certain resources | 98 // here. (For example, the embedder might want to mark certain resources |
| 99 // differently if they use SHA1 signatures.) https://crbug.com/648326 | 99 // differently if they use SHA1 signatures.) https://crbug.com/648326 |
| 100 blink::WebSecurityStyle GetSecurityStyleForResource( | 100 blink::WebSecurityStyle GetSecurityStyleForResource( |
| 101 const GURL& url, | 101 const GURL& url, |
| 102 net::CertStatus cert_status) { | 102 net::CertStatus cert_status) { |
| 103 if (!url.SchemeIsCryptographic()) | 103 if (!url.SchemeIsCryptographic()) |
| 104 return blink::WebSecurityStyleUnauthenticated; | 104 return blink::WebSecurityStyleNeutral; |
| 105 | 105 |
| 106 // Minor errors don't lower the security style to | 106 // Minor errors don't lower the security style to |
| 107 // WebSecurityStyleAuthenticationBroken. | 107 // WebSecurityStyleAuthenticationBroken. |
| 108 if (net::IsCertStatusError(cert_status) && | 108 if (net::IsCertStatusError(cert_status) && |
| 109 !net::IsCertStatusMinorError(cert_status)) { | 109 !net::IsCertStatusMinorError(cert_status)) { |
| 110 return blink::WebSecurityStyleAuthenticationBroken; | 110 return blink::WebSecurityStyleInsecure; |
| 111 } | 111 } |
| 112 | 112 |
| 113 return blink::WebSecurityStyleAuthenticated; | 113 return blink::WebSecurityStyleSecure; |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Converts timing data from |load_timing| to the format used by WebKit. | 116 // Converts timing data from |load_timing| to the format used by WebKit. |
| 117 void PopulateURLLoadTiming(const net::LoadTimingInfo& load_timing, | 117 void PopulateURLLoadTiming(const net::LoadTimingInfo& load_timing, |
| 118 WebURLLoadTiming* url_timing) { | 118 WebURLLoadTiming* url_timing) { |
| 119 DCHECK(!load_timing.request_start.is_null()); | 119 DCHECK(!load_timing.request_start.is_null()); |
| 120 | 120 |
| 121 const TimeTicks kNullTicks; | 121 const TimeTicks kNullTicks; |
| 122 url_timing->initialize(); | 122 url_timing->initialize(); |
| 123 url_timing->setRequestTime( | 123 url_timing->setRequestTime( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 | 252 |
| 253 void SetSecurityStyleAndDetails(const GURL& url, | 253 void SetSecurityStyleAndDetails(const GURL& url, |
| 254 const ResourceResponseInfo& info, | 254 const ResourceResponseInfo& info, |
| 255 WebURLResponse* response, | 255 WebURLResponse* response, |
| 256 bool report_security_info) { | 256 bool report_security_info) { |
| 257 if (!report_security_info) { | 257 if (!report_security_info) { |
| 258 response->setSecurityStyle(blink::WebSecurityStyleUnknown); | 258 response->setSecurityStyle(blink::WebSecurityStyleUnknown); |
| 259 return; | 259 return; |
| 260 } | 260 } |
| 261 if (!url.SchemeIsCryptographic()) { | 261 if (!url.SchemeIsCryptographic()) { |
| 262 response->setSecurityStyle(blink::WebSecurityStyleUnauthenticated); | 262 response->setSecurityStyle(blink::WebSecurityStyleNeutral); |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 | 265 |
| 266 // There are cases where an HTTPS request can come in without security | 266 // The resource loader does not provide a guarantee that requests always have |
| 267 // info attached (such as a redirect response). | 267 // security info (such as a certificate) attached. Use WebSecurityStyleUnknown |
|
estark
2017/03/22 17:32:27
(unrelated comment cleanup while I was here)
| |
| 268 // in this case where there isn't enough information to be useful. | |
| 268 if (info.certificate.empty()) { | 269 if (info.certificate.empty()) { |
| 269 response->setSecurityStyle(blink::WebSecurityStyleUnknown); | 270 response->setSecurityStyle(blink::WebSecurityStyleUnknown); |
| 270 return; | 271 return; |
| 271 } | 272 } |
| 272 | 273 |
| 273 int ssl_version = | 274 int ssl_version = |
| 274 net::SSLConnectionStatusToVersion(info.ssl_connection_status); | 275 net::SSLConnectionStatusToVersion(info.ssl_connection_status); |
| 275 const char* protocol; | 276 const char* protocol; |
| 276 net::SSLVersionToString(&protocol, ssl_version); | 277 net::SSLVersionToString(&protocol, ssl_version); |
| 277 | 278 |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1248 int intra_priority_value) { | 1249 int intra_priority_value) { |
| 1249 context_->DidChangePriority(new_priority, intra_priority_value); | 1250 context_->DidChangePriority(new_priority, intra_priority_value); |
| 1250 } | 1251 } |
| 1251 | 1252 |
| 1252 void WebURLLoaderImpl::setLoadingTaskRunner( | 1253 void WebURLLoaderImpl::setLoadingTaskRunner( |
| 1253 base::SingleThreadTaskRunner* loading_task_runner) { | 1254 base::SingleThreadTaskRunner* loading_task_runner) { |
| 1254 context_->SetTaskRunner(loading_task_runner); | 1255 context_->SetTaskRunner(loading_task_runner); |
| 1255 } | 1256 } |
| 1256 | 1257 |
| 1257 } // namespace content | 1258 } // namespace content |
| OLD | NEW |