| 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 "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 5 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 std::string(), nullptr); | 126 std::string(), nullptr); |
| 127 } | 127 } |
| 128 // Remove the old pattern. | 128 // Remove the old pattern. |
| 129 map->SetWebsiteSettingCustomScope( | 129 map->SetWebsiteSettingCustomScope( |
| 130 setting.primary_pattern, setting.secondary_pattern, | 130 setting.primary_pattern, setting.secondary_pattern, |
| 131 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), nullptr); | 131 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), nullptr); |
| 132 // Set the new pattern. | 132 // Set the new pattern. |
| 133 if (value) { | 133 if (value) { |
| 134 map->SetWebsiteSettingDefaultScope( | 134 map->SetWebsiteSettingDefaultScope( |
| 135 url, GURL(), CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 135 url, GURL(), CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
| 136 std::string(), value.release()); | 136 std::string(), std::move(value)); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace | 142 } // namespace |
| 143 | 143 |
| 144 // This helper function gets the dictionary of certificate fingerprints to | 144 // This helper function gets the dictionary of certificate fingerprints to |
| 145 // errors of certificates that have been accepted by the user from the content | 145 // errors of certificates that have been accepted by the user from the content |
| 146 // dictionary that has been passed in. The returned pointer is owned by the the | 146 // dictionary that has been passed in. The returned pointer is owned by the the |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return; | 303 return; |
| 304 | 304 |
| 305 dict->SetIntegerWithoutPathExpansion(kSSLCertDecisionVersionKey, | 305 dict->SetIntegerWithoutPathExpansion(kSSLCertDecisionVersionKey, |
| 306 kDefaultSSLCertDecisionVersion); | 306 kDefaultSSLCertDecisionVersion); |
| 307 cert_dict->SetIntegerWithoutPathExpansion(GetKey(cert, error), ALLOWED); | 307 cert_dict->SetIntegerWithoutPathExpansion(GetKey(cert, error), ALLOWED); |
| 308 | 308 |
| 309 // The map takes ownership of the value, so it is released in the call to | 309 // The map takes ownership of the value, so it is released in the call to |
| 310 // SetWebsiteSettingDefaultScope. | 310 // SetWebsiteSettingDefaultScope. |
| 311 map->SetWebsiteSettingDefaultScope(url, GURL(), | 311 map->SetWebsiteSettingDefaultScope(url, GURL(), |
| 312 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 312 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
| 313 std::string(), value.release()); | 313 std::string(), std::move(value)); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void ChromeSSLHostStateDelegate::Clear() { | 316 void ChromeSSLHostStateDelegate::Clear() { |
| 317 HostContentSettingsMapFactory::GetForProfile(profile_) | 317 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 318 ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS); | 318 ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS); |
| 319 } | 319 } |
| 320 | 320 |
| 321 content::SSLHostStateDelegate::CertJudgment | 321 content::SSLHostStateDelegate::CertJudgment |
| 322 ChromeSSLHostStateDelegate::QueryPolicy(const std::string& host, | 322 ChromeSSLHostStateDelegate::QueryPolicy(const std::string& host, |
| 323 const net::X509Certificate& cert, | 323 const net::X509Certificate& cert, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 371 } |
| 372 | 372 |
| 373 void ChromeSSLHostStateDelegate::RevokeUserAllowExceptions( | 373 void ChromeSSLHostStateDelegate::RevokeUserAllowExceptions( |
| 374 const std::string& host) { | 374 const std::string& host) { |
| 375 GURL url = GetSecureGURLForHost(host); | 375 GURL url = GetSecureGURLForHost(host); |
| 376 HostContentSettingsMap* map = | 376 HostContentSettingsMap* map = |
| 377 HostContentSettingsMapFactory::GetForProfile(profile_); | 377 HostContentSettingsMapFactory::GetForProfile(profile_); |
| 378 | 378 |
| 379 map->SetWebsiteSettingDefaultScope(url, GURL(), | 379 map->SetWebsiteSettingDefaultScope(url, GURL(), |
| 380 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 380 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
| 381 std::string(), NULL); | 381 std::string(), nullptr); |
| 382 } | 382 } |
| 383 | 383 |
| 384 // TODO(jww): This will revoke all of the decisions in the browser context. | 384 // TODO(jww): This will revoke all of the decisions in the browser context. |
| 385 // However, the networking stack actually keeps track of its own list of | 385 // However, the networking stack actually keeps track of its own list of |
| 386 // exceptions per-HttpNetworkTransaction in the SSLConfig structure (see the | 386 // exceptions per-HttpNetworkTransaction in the SSLConfig structure (see the |
| 387 // allowed_bad_certs Vector in net/ssl/ssl_config.h). This dual-tracking of | 387 // allowed_bad_certs Vector in net/ssl/ssl_config.h). This dual-tracking of |
| 388 // exceptions introduces a problem where the browser context can revoke a | 388 // exceptions introduces a problem where the browser context can revoke a |
| 389 // certificate, but if a transaction reuses a cached version of the SSLConfig | 389 // certificate, but if a transaction reuses a cached version of the SSLConfig |
| 390 // (probably from a pooled socket), it may bypass the intestitial layer. | 390 // (probably from a pooled socket), it may bypass the intestitial layer. |
| 391 // | 391 // |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 } | 440 } |
| 441 | 441 |
| 442 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( | 442 bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( |
| 443 const std::string& host, | 443 const std::string& host, |
| 444 int pid) const { | 444 int pid) const { |
| 445 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); | 445 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); |
| 446 } | 446 } |
| 447 void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr<base::Clock> clock) { | 447 void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr<base::Clock> clock) { |
| 448 clock_.reset(clock.release()); | 448 clock_.reset(clock.release()); |
| 449 } | 449 } |
| OLD | NEW |