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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram.h" | |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
13 #include "base/time/clock.h" | 14 #include "base/time/clock.h" |
14 #include "base/time/default_clock.h" | 15 #include "base/time/default_clock.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "components/content_settings/core/common/content_settings_types.h" | 20 #include "components/content_settings/core/common/content_settings_types.h" |
20 #include "components/variations/variations_associated_data.h" | 21 #include "components/variations/variations_associated_data.h" |
21 #include "net/base/hash_value.h" | 22 #include "net/base/hash_value.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 // | 333 // |
333 // Over time, the cached versions should expire and it should converge on | 334 // Over time, the cached versions should expire and it should converge on |
334 // showing the interstitial. We probably need to introduce into the networking | 335 // showing the interstitial. We probably need to introduce into the networking |
335 // stack a way revoke SSLConfig's allowed_bad_certs lists per socket. | 336 // stack a way revoke SSLConfig's allowed_bad_certs lists per socket. |
336 // | 337 // |
337 // For now, RevokeUserDecisionsHard is our solution for the rare case where it | 338 // For now, RevokeUserDecisionsHard is our solution for the rare case where it |
338 // is necessary to revoke the preferences immediately. It does so by flushing | 339 // is necessary to revoke the preferences immediately. It does so by flushing |
339 // idle sockets. | 340 // idle sockets. |
340 void ChromeSSLHostStateDelegate::RevokeUserDecisionsHard( | 341 void ChromeSSLHostStateDelegate::RevokeUserDecisionsHard( |
341 const std::string& host) { | 342 const std::string& host) { |
343 UMA_HISTOGRAM_COUNTS("interstitial.ssl.revoke_user_decisions_hard", 1); | |
jar (doing other things)
2014/08/14 22:10:37
Several issues/suggestions:
Yeah, this would in a
| |
342 RevokeUserDecisions(host); | 344 RevokeUserDecisions(host); |
343 scoped_refptr<net::URLRequestContextGetter> getter( | 345 scoped_refptr<net::URLRequestContextGetter> getter( |
344 profile_->GetRequestContext()); | 346 profile_->GetRequestContext()); |
345 profile_->GetRequestContext()->GetNetworkTaskRunner()->PostTask( | 347 profile_->GetRequestContext()->GetNetworkTaskRunner()->PostTask( |
346 FROM_HERE, base::Bind(&CloseIdleConnections, getter)); | 348 FROM_HERE, base::Bind(&CloseIdleConnections, getter)); |
347 } | 349 } |
348 | 350 |
349 bool ChromeSSLHostStateDelegate::HasUserDecision(const std::string& host) { | 351 bool ChromeSSLHostStateDelegate::HasUserDecision(const std::string& host) { |
350 GURL url = GetSecureGURLForHost(host); | 352 GURL url = GetSecureGURLForHost(host); |
351 const ContentSettingsPattern pattern = | 353 const ContentSettingsPattern pattern = |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 cert_dict->SetIntegerWithoutPathExpansion(GetKey(cert, error), judgment); | 421 cert_dict->SetIntegerWithoutPathExpansion(GetKey(cert, error), judgment); |
420 | 422 |
421 // The map takes ownership of the value, so it is released in the call to | 423 // The map takes ownership of the value, so it is released in the call to |
422 // SetWebsiteSetting. | 424 // SetWebsiteSetting. |
423 map->SetWebsiteSetting(pattern, | 425 map->SetWebsiteSetting(pattern, |
424 pattern, | 426 pattern, |
425 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, | 427 CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, |
426 std::string(), | 428 std::string(), |
427 value.release()); | 429 value.release()); |
428 } | 430 } |
OLD | NEW |