| 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 "components/security_state/security_state_model.h" | 5 #include "components/security_state/security_state_model.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 switch (visible_security_state.initial_security_level) { | 101 switch (visible_security_state.initial_security_level) { |
| 102 case SecurityStateModel::NONE: { | 102 case SecurityStateModel::NONE: { |
| 103 if (!client->IsOriginSecure(url) && url.IsStandard()) | 103 if (!client->IsOriginSecure(url) && url.IsStandard()) |
| 104 return GetSecurityLevelForNonSecureFieldTrial(); | 104 return GetSecurityLevelForNonSecureFieldTrial(); |
| 105 return SecurityStateModel::NONE; | 105 return SecurityStateModel::NONE; |
| 106 } | 106 } |
| 107 | 107 |
| 108 case SecurityStateModel::SECURITY_ERROR: | 108 case SecurityStateModel::SECURITY_ERROR: |
| 109 return SecurityStateModel::SECURITY_ERROR; | 109 return SecurityStateModel::SECURITY_ERROR; |
| 110 | 110 |
| 111 case SecurityStateModel::SECURITY_WARNING: | |
| 112 case SecurityStateModel::SECURITY_POLICY_WARNING: | 111 case SecurityStateModel::SECURITY_POLICY_WARNING: |
| 113 return visible_security_state.initial_security_level; | 112 return visible_security_state.initial_security_level; |
| 114 | 113 |
| 115 case SecurityStateModel::SECURE: | 114 case SecurityStateModel::SECURE: |
| 116 case SecurityStateModel::EV_SECURE: { | 115 case SecurityStateModel::EV_SECURE: { |
| 117 // Major cert errors and active mixed content will generally be | 116 // Major cert errors and active mixed content will generally be |
| 118 // downgraded by the embedder to SECURITY_ERROR and handled above, | 117 // downgraded by the embedder to SECURITY_ERROR and handled above, |
| 119 // but downgrade here just in case. | 118 // but downgrade here just in case. |
| 120 net::CertStatus cert_status = visible_security_state.cert_status; | 119 net::CertStatus cert_status = visible_security_state.cert_status; |
| 121 if (net::IsCertStatusError(cert_status) && | 120 if (net::IsCertStatusError(cert_status) && |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 content_with_cert_errors_status == | 154 content_with_cert_errors_status == |
| 156 SecurityStateModel::CONTENT_STATUS_DISPLAYED) { | 155 SecurityStateModel::CONTENT_STATUS_DISPLAYED) { |
| 157 return SecurityStateModel::kDisplayedInsecureContentLevel; | 156 return SecurityStateModel::kDisplayedInsecureContentLevel; |
| 158 } | 157 } |
| 159 | 158 |
| 160 if (net::IsCertStatusError(cert_status)) { | 159 if (net::IsCertStatusError(cert_status)) { |
| 161 // Major cert errors are handled above. | 160 // Major cert errors are handled above. |
| 162 DCHECK(net::IsCertStatusMinorError(cert_status)); | 161 DCHECK(net::IsCertStatusMinorError(cert_status)); |
| 163 return SecurityStateModel::NONE; | 162 return SecurityStateModel::NONE; |
| 164 } | 163 } |
| 165 if (net::SSLConnectionStatusToVersion( | |
| 166 visible_security_state.connection_status) == | |
| 167 net::SSL_CONNECTION_VERSION_SSL3) { | |
| 168 // SSLv3 will be removed in the future. | |
| 169 return SecurityStateModel::SECURITY_WARNING; | |
| 170 } | |
| 171 if ((cert_status & net::CERT_STATUS_IS_EV) && cert) | 164 if ((cert_status & net::CERT_STATUS_IS_EV) && cert) |
| 172 return SecurityStateModel::EV_SECURE; | 165 return SecurityStateModel::EV_SECURE; |
| 173 return SecurityStateModel::SECURE; | 166 return SecurityStateModel::SECURE; |
| 174 } | 167 } |
| 175 } | 168 } |
| 176 | 169 |
| 177 return SecurityStateModel::NONE; | 170 return SecurityStateModel::NONE; |
| 178 } | 171 } |
| 179 | 172 |
| 180 void SecurityInfoForRequest( | 173 void SecurityInfoForRequest( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 sct_verify_statuses == other.sct_verify_statuses && | 307 sct_verify_statuses == other.sct_verify_statuses && |
| 315 displayed_mixed_content == other.displayed_mixed_content && | 308 displayed_mixed_content == other.displayed_mixed_content && |
| 316 ran_mixed_content == other.ran_mixed_content && | 309 ran_mixed_content == other.ran_mixed_content && |
| 317 displayed_content_with_cert_errors == | 310 displayed_content_with_cert_errors == |
| 318 other.displayed_content_with_cert_errors && | 311 other.displayed_content_with_cert_errors && |
| 319 ran_content_with_cert_errors == other.ran_content_with_cert_errors && | 312 ran_content_with_cert_errors == other.ran_content_with_cert_errors && |
| 320 pkp_bypassed == other.pkp_bypassed); | 313 pkp_bypassed == other.pkp_bypassed); |
| 321 } | 314 } |
| 322 | 315 |
| 323 } // namespace security_state | 316 } // namespace security_state |
| OLD | NEW |