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/core/security_state.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" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "components/security_state/security_state_model_client.h" | 12 #include "components/security_state/core/switches.h" |
13 #include "components/security_state/switches.h" | |
14 #include "net/ssl/ssl_cipher_suite_names.h" | 13 #include "net/ssl/ssl_cipher_suite_names.h" |
15 #include "net/ssl/ssl_connection_status_flags.h" | 14 #include "net/ssl/ssl_connection_status_flags.h" |
16 | 15 |
17 namespace security_state { | 16 namespace security_state { |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 // Do not change or reorder this enum, and add new values at the end. It is used | 20 // Do not change or reorder this enum, and add new values at the end. It is used |
22 // in the MarkHttpAs histogram. | 21 // in the MarkHttpAs histogram. |
23 enum MarkHttpStatus { NEUTRAL, NON_SECURE, HTTP_SHOW_WARNING, LAST_STATUS }; | 22 enum MarkHttpStatus { NEUTRAL, NON_SECURE, HTTP_SHOW_WARNING, LAST_STATUS }; |
24 | 23 |
25 // If |switch_or_field_trial_group| corresponds to a valid | 24 // If |switch_or_field_trial_group| corresponds to a valid |
26 // MarkHttpAs group, sets |*level| and |*histogram_status| to the | 25 // MarkHttpAs group, sets |*level| and |*histogram_status| to the |
27 // appropriate values and returns true. Otherwise, returns false. | 26 // appropriate values and returns true. Otherwise, returns false. |
28 bool GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( | 27 bool GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( |
29 std::string switch_or_field_trial_group, | 28 std::string switch_or_field_trial_group, |
30 bool displayed_sensitive_input_on_http, | 29 bool displayed_sensitive_input_on_http, |
31 SecurityStateModel::SecurityLevel* level, | 30 SecurityLevel* level, |
32 MarkHttpStatus* histogram_status) { | 31 MarkHttpStatus* histogram_status) { |
33 if (switch_or_field_trial_group == switches::kMarkHttpAsNeutral) { | 32 if (switch_or_field_trial_group == switches::kMarkHttpAsNeutral) { |
34 *level = SecurityStateModel::NONE; | 33 *level = NONE; |
35 *histogram_status = NEUTRAL; | 34 *histogram_status = NEUTRAL; |
36 return true; | 35 return true; |
37 } | 36 } |
38 | 37 |
39 if (switch_or_field_trial_group == switches::kMarkHttpAsDangerous) { | 38 if (switch_or_field_trial_group == switches::kMarkHttpAsDangerous) { |
40 *level = SecurityStateModel::DANGEROUS; | 39 *level = DANGEROUS; |
41 *histogram_status = NON_SECURE; | 40 *histogram_status = NON_SECURE; |
42 return true; | 41 return true; |
43 } | 42 } |
44 | 43 |
45 if (switch_or_field_trial_group == | 44 if (switch_or_field_trial_group == |
46 switches::kMarkHttpWithPasswordsOrCcWithChip) { | 45 switches::kMarkHttpWithPasswordsOrCcWithChip) { |
47 if (displayed_sensitive_input_on_http) { | 46 if (displayed_sensitive_input_on_http) { |
48 *level = SecurityStateModel::HTTP_SHOW_WARNING; | 47 *level = security_state::HTTP_SHOW_WARNING; |
49 } else { | 48 } else { |
50 *level = SecurityStateModel::NONE; | 49 *level = NONE; |
51 } | 50 } |
52 *histogram_status = HTTP_SHOW_WARNING; | 51 *histogram_status = HTTP_SHOW_WARNING; |
53 return true; | 52 return true; |
54 } | 53 } |
55 | 54 |
56 return false; | 55 return false; |
57 } | 56 } |
58 | 57 |
59 SecurityStateModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial( | 58 SecurityLevel GetSecurityLevelForNonSecureFieldTrial( |
60 bool displayed_sensitive_input_on_http) { | 59 bool displayed_sensitive_input_on_http) { |
61 std::string choice = | 60 std::string choice = |
62 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 61 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
63 switches::kMarkHttpAs); | 62 switches::kMarkHttpAs); |
64 std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); | 63 std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); |
65 | 64 |
66 const char kEnumeration[] = "SSL.MarkHttpAsStatus"; | 65 const char kEnumeration[] = "SSL.MarkHttpAsStatus"; |
67 | 66 |
68 SecurityStateModel::SecurityLevel level = SecurityStateModel::NONE; | 67 SecurityLevel level = NONE; |
69 MarkHttpStatus status; | 68 MarkHttpStatus status; |
70 | 69 |
71 // If the command-line switch is set, then it takes precedence over | 70 // If the command-line switch is set, then it takes precedence over |
72 // the field trial group. | 71 // the field trial group. |
73 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( | 72 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( |
74 choice, displayed_sensitive_input_on_http, &level, &status)) { | 73 choice, displayed_sensitive_input_on_http, &level, &status)) { |
75 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( | 74 if (!GetSecurityLevelAndHistogramValueForNonSecureFieldTrial( |
76 group, displayed_sensitive_input_on_http, &level, &status)) { | 75 group, displayed_sensitive_input_on_http, &level, &status)) { |
77 // If neither the command-line switch nor field trial group is set, then | 76 // If neither the command-line switch nor field trial group is set, then |
78 // nonsecure defaults to neutral. | 77 // nonsecure defaults to neutral. |
79 status = NEUTRAL; | 78 status = NEUTRAL; |
80 level = SecurityStateModel::NONE; | 79 level = NONE; |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 UMA_HISTOGRAM_ENUMERATION(kEnumeration, status, LAST_STATUS); | 83 UMA_HISTOGRAM_ENUMERATION(kEnumeration, status, LAST_STATUS); |
85 return level; | 84 return level; |
86 } | 85 } |
87 | 86 |
88 SecurityStateModel::SHA1DeprecationStatus GetSHA1DeprecationStatus( | 87 SHA1DeprecationStatus GetSHA1DeprecationStatus( |
89 const SecurityStateModel::VisibleSecurityState& visible_security_state) { | 88 const VisibleSecurityState& visible_security_state) { |
90 if (!visible_security_state.certificate || | 89 if (!visible_security_state.certificate || |
91 !(visible_security_state.cert_status & | 90 !(visible_security_state.cert_status & |
92 net::CERT_STATUS_SHA1_SIGNATURE_PRESENT)) | 91 net::CERT_STATUS_SHA1_SIGNATURE_PRESENT)) |
93 return SecurityStateModel::NO_DEPRECATED_SHA1; | 92 return NO_DEPRECATED_SHA1; |
94 | 93 |
95 // The internal representation of the dates for UI treatment of SHA-1. | 94 // The internal representation of the dates for UI treatment of SHA-1. |
96 // See http://crbug.com/401365 for details. | 95 // See http://crbug.com/401365 for details. |
97 static const int64_t kJanuary2017 = INT64_C(13127702400000000); | 96 static const int64_t kJanuary2017 = INT64_C(13127702400000000); |
98 if (visible_security_state.certificate->valid_expiry() >= | 97 if (visible_security_state.certificate->valid_expiry() >= |
99 base::Time::FromInternalValue(kJanuary2017)) | 98 base::Time::FromInternalValue(kJanuary2017)) |
100 return SecurityStateModel::DEPRECATED_SHA1_MAJOR; | 99 return DEPRECATED_SHA1_MAJOR; |
101 static const int64_t kJanuary2016 = INT64_C(13096080000000000); | 100 static const int64_t kJanuary2016 = INT64_C(13096080000000000); |
102 if (visible_security_state.certificate->valid_expiry() >= | 101 if (visible_security_state.certificate->valid_expiry() >= |
103 base::Time::FromInternalValue(kJanuary2016)) | 102 base::Time::FromInternalValue(kJanuary2016)) |
104 return SecurityStateModel::DEPRECATED_SHA1_MINOR; | 103 return DEPRECATED_SHA1_MINOR; |
105 | 104 |
106 return SecurityStateModel::NO_DEPRECATED_SHA1; | 105 return NO_DEPRECATED_SHA1; |
107 } | 106 } |
108 | 107 |
109 SecurityStateModel::ContentStatus GetContentStatus(bool displayed, bool ran) { | 108 ContentStatus GetContentStatus(bool displayed, bool ran) { |
110 if (ran && displayed) | 109 if (ran && displayed) |
111 return SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN; | 110 return CONTENT_STATUS_DISPLAYED_AND_RAN; |
112 if (ran) | 111 if (ran) |
113 return SecurityStateModel::CONTENT_STATUS_RAN; | 112 return CONTENT_STATUS_RAN; |
114 if (displayed) | 113 if (displayed) |
115 return SecurityStateModel::CONTENT_STATUS_DISPLAYED; | 114 return CONTENT_STATUS_DISPLAYED; |
116 return SecurityStateModel::CONTENT_STATUS_NONE; | 115 return CONTENT_STATUS_NONE; |
117 } | 116 } |
118 | 117 |
119 SecurityStateModel::SecurityLevel GetSecurityLevelForRequest( | 118 SecurityLevel GetSecurityLevelForRequest( |
120 const SecurityStateModel::VisibleSecurityState& visible_security_state, | 119 const VisibleSecurityState& visible_security_state, |
121 SecurityStateModelClient* client, | 120 bool used_policy_installed_certificate, |
122 SecurityStateModel::SHA1DeprecationStatus sha1_status, | 121 const IsOriginSecureCallback& is_origin_secure_callback, |
123 SecurityStateModel::ContentStatus mixed_content_status, | 122 SHA1DeprecationStatus sha1_status, |
124 SecurityStateModel::ContentStatus content_with_cert_errors_status) { | 123 ContentStatus mixed_content_status, |
| 124 ContentStatus content_with_cert_errors_status) { |
125 DCHECK(visible_security_state.connection_info_initialized || | 125 DCHECK(visible_security_state.connection_info_initialized || |
126 visible_security_state.fails_malware_check); | 126 visible_security_state.fails_malware_check); |
127 | 127 |
128 // Override the connection security information if the website failed the | 128 // Override the connection security information if the website failed the |
129 // browser's malware checks. | 129 // browser's malware checks. |
130 if (visible_security_state.fails_malware_check) | 130 if (visible_security_state.fails_malware_check) |
131 return SecurityStateModel::DANGEROUS; | 131 return DANGEROUS; |
132 | 132 |
133 GURL url = visible_security_state.url; | 133 GURL url = visible_security_state.url; |
134 | 134 |
135 bool is_cryptographic_with_certificate = | 135 bool is_cryptographic_with_certificate = |
136 (url.SchemeIsCryptographic() && visible_security_state.certificate); | 136 (url.SchemeIsCryptographic() && visible_security_state.certificate); |
137 | 137 |
138 // Set the security level to DANGEROUS for major certificate errors. | 138 // Set the security level to DANGEROUS for major certificate errors. |
139 if (is_cryptographic_with_certificate && | 139 if (is_cryptographic_with_certificate && |
140 net::IsCertStatusError(visible_security_state.cert_status) && | 140 net::IsCertStatusError(visible_security_state.cert_status) && |
141 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { | 141 !net::IsCertStatusMinorError(visible_security_state.cert_status)) { |
142 return SecurityStateModel::DANGEROUS; | 142 return DANGEROUS; |
143 } | 143 } |
144 | 144 |
145 // Choose the appropriate security level for HTTP requests. | 145 // Choose the appropriate security level for HTTP requests. |
146 if (!is_cryptographic_with_certificate) { | 146 if (!is_cryptographic_with_certificate) { |
147 if (!client->IsOriginSecure(url) && url.IsStandard()) { | 147 if (!is_origin_secure_callback.Run(url) && url.IsStandard()) { |
148 return GetSecurityLevelForNonSecureFieldTrial( | 148 return GetSecurityLevelForNonSecureFieldTrial( |
149 visible_security_state.displayed_password_field_on_http || | 149 visible_security_state.displayed_password_field_on_http || |
150 visible_security_state.displayed_credit_card_field_on_http); | 150 visible_security_state.displayed_credit_card_field_on_http); |
151 } | 151 } |
152 return SecurityStateModel::NONE; | 152 return NONE; |
153 } | 153 } |
154 | 154 |
155 // Downgrade the security level for active insecure subresources. | 155 // Downgrade the security level for active insecure subresources. |
156 if (mixed_content_status == SecurityStateModel::CONTENT_STATUS_RAN || | 156 if (mixed_content_status == CONTENT_STATUS_RAN || |
157 mixed_content_status == | 157 mixed_content_status == CONTENT_STATUS_DISPLAYED_AND_RAN || |
158 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN || | 158 content_with_cert_errors_status == CONTENT_STATUS_RAN || |
159 content_with_cert_errors_status == | 159 content_with_cert_errors_status == CONTENT_STATUS_DISPLAYED_AND_RAN) { |
160 SecurityStateModel::CONTENT_STATUS_RAN || | 160 return kRanInsecureContentLevel; |
161 content_with_cert_errors_status == | |
162 SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN) { | |
163 return SecurityStateModel::kRanInsecureContentLevel; | |
164 } | 161 } |
165 | 162 |
166 // Report if there is a policy cert first, before reporting any other | 163 // Report if there is a policy cert first, before reporting any other |
167 // authenticated-but-with-errors cases. A policy cert is a strong | 164 // authenticated-but-with-errors cases. A policy cert is a strong |
168 // indicator of a MITM being present (the enterprise), while the | 165 // indicator of a MITM being present (the enterprise), while the |
169 // other authenticated-but-with-errors indicate something may | 166 // other authenticated-but-with-errors indicate something may |
170 // be wrong, or may be wrong in the future, but is unclear now. | 167 // be wrong, or may be wrong in the future, but is unclear now. |
171 if (client->UsedPolicyInstalledCertificate()) | 168 if (used_policy_installed_certificate) |
172 return SecurityStateModel::SECURE_WITH_POLICY_INSTALLED_CERT; | 169 return SECURE_WITH_POLICY_INSTALLED_CERT; |
173 | 170 |
174 if (sha1_status == SecurityStateModel::DEPRECATED_SHA1_MAJOR) | 171 if (sha1_status == DEPRECATED_SHA1_MAJOR) |
175 return SecurityStateModel::DANGEROUS; | 172 return DANGEROUS; |
176 if (sha1_status == SecurityStateModel::DEPRECATED_SHA1_MINOR) | 173 if (sha1_status == DEPRECATED_SHA1_MINOR) |
177 return SecurityStateModel::NONE; | 174 return NONE; |
178 | 175 |
179 // Active mixed content is handled above. | 176 // Active mixed content is handled above. |
180 DCHECK_NE(SecurityStateModel::CONTENT_STATUS_RAN, mixed_content_status); | 177 DCHECK_NE(CONTENT_STATUS_RAN, mixed_content_status); |
181 DCHECK_NE(SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, | 178 DCHECK_NE(CONTENT_STATUS_DISPLAYED_AND_RAN, mixed_content_status); |
182 mixed_content_status); | |
183 | 179 |
184 if (mixed_content_status == SecurityStateModel::CONTENT_STATUS_DISPLAYED || | 180 if (mixed_content_status == CONTENT_STATUS_DISPLAYED || |
185 content_with_cert_errors_status == | 181 content_with_cert_errors_status == CONTENT_STATUS_DISPLAYED) { |
186 SecurityStateModel::CONTENT_STATUS_DISPLAYED) { | 182 return kDisplayedInsecureContentLevel; |
187 return SecurityStateModel::kDisplayedInsecureContentLevel; | |
188 } | 183 } |
189 | 184 |
190 if (net::IsCertStatusError(visible_security_state.cert_status)) { | 185 if (net::IsCertStatusError(visible_security_state.cert_status)) { |
191 // Major cert errors are handled above. | 186 // Major cert errors are handled above. |
192 DCHECK(net::IsCertStatusMinorError(visible_security_state.cert_status)); | 187 DCHECK(net::IsCertStatusMinorError(visible_security_state.cert_status)); |
193 return SecurityStateModel::NONE; | 188 return NONE; |
194 } | 189 } |
195 | 190 |
196 if ((visible_security_state.cert_status & net::CERT_STATUS_IS_EV) && | 191 if ((visible_security_state.cert_status & net::CERT_STATUS_IS_EV) && |
197 visible_security_state.certificate) { | 192 visible_security_state.certificate) { |
198 return SecurityStateModel::EV_SECURE; | 193 return EV_SECURE; |
199 } | 194 } |
200 return SecurityStateModel::SECURE; | 195 return SECURE; |
201 } | 196 } |
202 | 197 |
203 void SecurityInfoForRequest( | 198 void SecurityInfoForRequest( |
204 SecurityStateModelClient* client, | 199 const VisibleSecurityState& visible_security_state, |
205 const SecurityStateModel::VisibleSecurityState& visible_security_state, | 200 bool used_policy_installed_certificate, |
206 SecurityStateModel::SecurityInfo* security_info) { | 201 const IsOriginSecureCallback& is_origin_secure_callback, |
| 202 SecurityInfo* security_info) { |
207 if (!visible_security_state.connection_info_initialized) { | 203 if (!visible_security_state.connection_info_initialized) { |
208 *security_info = SecurityStateModel::SecurityInfo(); | 204 *security_info = SecurityInfo(); |
209 security_info->fails_malware_check = | 205 security_info->fails_malware_check = |
210 visible_security_state.fails_malware_check; | 206 visible_security_state.fails_malware_check; |
211 if (security_info->fails_malware_check) { | 207 if (security_info->fails_malware_check) { |
212 security_info->security_level = GetSecurityLevelForRequest( | 208 security_info->security_level = GetSecurityLevelForRequest( |
213 visible_security_state, client, SecurityStateModel::UNKNOWN_SHA1, | 209 visible_security_state, used_policy_installed_certificate, |
214 SecurityStateModel::CONTENT_STATUS_UNKNOWN, | 210 is_origin_secure_callback, UNKNOWN_SHA1, CONTENT_STATUS_UNKNOWN, |
215 SecurityStateModel::CONTENT_STATUS_UNKNOWN); | 211 CONTENT_STATUS_UNKNOWN); |
216 } | 212 } |
217 return; | 213 return; |
218 } | 214 } |
219 security_info->certificate = visible_security_state.certificate; | 215 security_info->certificate = visible_security_state.certificate; |
220 security_info->sha1_deprecation_status = | 216 security_info->sha1_deprecation_status = |
221 GetSHA1DeprecationStatus(visible_security_state); | 217 GetSHA1DeprecationStatus(visible_security_state); |
222 security_info->mixed_content_status = | 218 security_info->mixed_content_status = |
223 GetContentStatus(visible_security_state.displayed_mixed_content, | 219 GetContentStatus(visible_security_state.displayed_mixed_content, |
224 visible_security_state.ran_mixed_content); | 220 visible_security_state.ran_mixed_content); |
225 security_info->content_with_cert_errors_status = GetContentStatus( | 221 security_info->content_with_cert_errors_status = GetContentStatus( |
(...skipping 12 matching lines...) Expand all Loading... |
238 visible_security_state.sct_verify_statuses; | 234 visible_security_state.sct_verify_statuses; |
239 | 235 |
240 security_info->fails_malware_check = | 236 security_info->fails_malware_check = |
241 visible_security_state.fails_malware_check; | 237 visible_security_state.fails_malware_check; |
242 | 238 |
243 security_info->displayed_private_user_data_input_on_http = | 239 security_info->displayed_private_user_data_input_on_http = |
244 visible_security_state.displayed_password_field_on_http || | 240 visible_security_state.displayed_password_field_on_http || |
245 visible_security_state.displayed_credit_card_field_on_http; | 241 visible_security_state.displayed_credit_card_field_on_http; |
246 | 242 |
247 security_info->security_level = GetSecurityLevelForRequest( | 243 security_info->security_level = GetSecurityLevelForRequest( |
248 visible_security_state, client, security_info->sha1_deprecation_status, | 244 visible_security_state, used_policy_installed_certificate, |
| 245 is_origin_secure_callback, security_info->sha1_deprecation_status, |
249 security_info->mixed_content_status, | 246 security_info->mixed_content_status, |
250 security_info->content_with_cert_errors_status); | 247 security_info->content_with_cert_errors_status); |
251 } | 248 } |
252 | 249 |
253 } // namespace | 250 } // namespace |
254 | 251 |
255 const SecurityStateModel::SecurityLevel | 252 SecurityInfo::SecurityInfo() |
256 SecurityStateModel::kDisplayedInsecureContentLevel = | 253 : security_level(NONE), |
257 SecurityStateModel::NONE; | |
258 const SecurityStateModel::SecurityLevel | |
259 SecurityStateModel::kRanInsecureContentLevel = | |
260 SecurityStateModel::DANGEROUS; | |
261 | |
262 SecurityStateModel::SecurityInfo::SecurityInfo() | |
263 : security_level(SecurityStateModel::NONE), | |
264 fails_malware_check(false), | 254 fails_malware_check(false), |
265 sha1_deprecation_status(SecurityStateModel::NO_DEPRECATED_SHA1), | 255 sha1_deprecation_status(NO_DEPRECATED_SHA1), |
266 mixed_content_status(SecurityStateModel::CONTENT_STATUS_NONE), | 256 mixed_content_status(CONTENT_STATUS_NONE), |
267 content_with_cert_errors_status(SecurityStateModel::CONTENT_STATUS_NONE), | 257 content_with_cert_errors_status(CONTENT_STATUS_NONE), |
268 scheme_is_cryptographic(false), | 258 scheme_is_cryptographic(false), |
269 cert_status(0), | 259 cert_status(0), |
270 security_bits(-1), | 260 security_bits(-1), |
271 connection_status(0), | 261 connection_status(0), |
272 key_exchange_group(0), | 262 key_exchange_group(0), |
273 obsolete_ssl_status(net::OBSOLETE_SSL_NONE), | 263 obsolete_ssl_status(net::OBSOLETE_SSL_NONE), |
274 pkp_bypassed(false), | 264 pkp_bypassed(false), |
275 displayed_private_user_data_input_on_http(false) {} | 265 displayed_private_user_data_input_on_http(false) {} |
276 | 266 |
277 SecurityStateModel::SecurityInfo::~SecurityInfo() {} | 267 SecurityInfo::~SecurityInfo() {} |
278 | 268 |
279 SecurityStateModel::SecurityStateModel() {} | 269 void GetSecurityInfo( |
280 | 270 std::unique_ptr<VisibleSecurityState> visible_security_state, |
281 SecurityStateModel::~SecurityStateModel() {} | 271 bool used_policy_installed_certificate, |
282 | 272 IsOriginSecureCallback is_origin_secure_callback, |
283 void SecurityStateModel::GetSecurityInfo( | 273 SecurityInfo* result) { |
284 SecurityStateModel::SecurityInfo* result) const { | 274 SecurityInfoForRequest(*visible_security_state, |
285 VisibleSecurityState new_visible_state; | 275 used_policy_installed_certificate, |
286 client_->GetVisibleSecurityState(&new_visible_state); | 276 is_origin_secure_callback, result); |
287 SecurityInfoForRequest(client_, new_visible_state, result); | |
288 } | 277 } |
289 | 278 |
290 void SecurityStateModel::SetClient(SecurityStateModelClient* client) { | 279 VisibleSecurityState::VisibleSecurityState() |
291 client_ = client; | |
292 } | |
293 | |
294 SecurityStateModel::VisibleSecurityState::VisibleSecurityState() | |
295 : fails_malware_check(false), | 280 : fails_malware_check(false), |
296 connection_info_initialized(false), | 281 connection_info_initialized(false), |
297 cert_status(0), | 282 cert_status(0), |
298 connection_status(0), | 283 connection_status(0), |
299 key_exchange_group(0), | 284 key_exchange_group(0), |
300 security_bits(-1), | 285 security_bits(-1), |
301 displayed_mixed_content(false), | 286 displayed_mixed_content(false), |
302 ran_mixed_content(false), | 287 ran_mixed_content(false), |
303 displayed_content_with_cert_errors(false), | 288 displayed_content_with_cert_errors(false), |
304 ran_content_with_cert_errors(false), | 289 ran_content_with_cert_errors(false), |
305 pkp_bypassed(false), | 290 pkp_bypassed(false), |
306 displayed_password_field_on_http(false), | 291 displayed_password_field_on_http(false), |
307 displayed_credit_card_field_on_http(false) {} | 292 displayed_credit_card_field_on_http(false) {} |
308 | 293 |
309 SecurityStateModel::VisibleSecurityState::~VisibleSecurityState() {} | 294 VisibleSecurityState::~VisibleSecurityState() {} |
310 | 295 |
311 bool SecurityStateModel::VisibleSecurityState::operator==( | 296 bool VisibleSecurityState::operator==(const VisibleSecurityState& other) const { |
312 const SecurityStateModel::VisibleSecurityState& other) const { | |
313 return (url == other.url && | 297 return (url == other.url && |
314 fails_malware_check == other.fails_malware_check && | 298 fails_malware_check == other.fails_malware_check && |
315 !!certificate == !!other.certificate && | 299 !!certificate == !!other.certificate && |
316 (certificate ? certificate->Equals(other.certificate.get()) : true) && | 300 (certificate ? certificate->Equals(other.certificate.get()) : true) && |
317 connection_status == other.connection_status && | 301 connection_status == other.connection_status && |
318 key_exchange_group == other.key_exchange_group && | 302 key_exchange_group == other.key_exchange_group && |
319 security_bits == other.security_bits && | 303 security_bits == other.security_bits && |
320 sct_verify_statuses == other.sct_verify_statuses && | 304 sct_verify_statuses == other.sct_verify_statuses && |
321 displayed_mixed_content == other.displayed_mixed_content && | 305 displayed_mixed_content == other.displayed_mixed_content && |
322 ran_mixed_content == other.ran_mixed_content && | 306 ran_mixed_content == other.ran_mixed_content && |
323 displayed_content_with_cert_errors == | 307 displayed_content_with_cert_errors == |
324 other.displayed_content_with_cert_errors && | 308 other.displayed_content_with_cert_errors && |
325 ran_content_with_cert_errors == other.ran_content_with_cert_errors && | 309 ran_content_with_cert_errors == other.ran_content_with_cert_errors && |
326 pkp_bypassed == other.pkp_bypassed && | 310 pkp_bypassed == other.pkp_bypassed && |
327 displayed_password_field_on_http == | 311 displayed_password_field_on_http == |
328 other.displayed_password_field_on_http && | 312 other.displayed_password_field_on_http && |
329 displayed_credit_card_field_on_http == | 313 displayed_credit_card_field_on_http == |
330 other.displayed_credit_card_field_on_http); | 314 other.displayed_credit_card_field_on_http); |
331 } | 315 } |
332 | 316 |
333 } // namespace security_state | 317 } // namespace security_state |
OLD | NEW |