| 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/ssl_error_handler.h" | 5 #include "chrome/browser/ssl/ssl_error_handler.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/threading/non_thread_safe.h" | |
| 20 #include "base/time/clock.h" | 19 #include "base/time/clock.h" |
| 21 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 22 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 23 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
| 25 #include "chrome/browser/ssl/ssl_blocking_page.h" | 24 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 26 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 25 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
| 27 #include "chrome/browser/ssl/ssl_error_assistant.pb.h" | 26 #include "chrome/browser/ssl/ssl_error_assistant.pb.h" |
| 28 #include "chrome/common/features.h" | 27 #include "chrome/common/features.h" |
| 29 #include "chrome/grit/browser_resources.h" | 28 #include "chrome/grit/browser_resources.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 160 } |
| 162 return hashes; | 161 return hashes; |
| 163 } | 162 } |
| 164 #endif | 163 #endif |
| 165 | 164 |
| 166 bool IsSSLCommonNameMismatchHandlingEnabled() { | 165 bool IsSSLCommonNameMismatchHandlingEnabled() { |
| 167 return base::FeatureList::IsEnabled(kSSLCommonNameMismatchHandling); | 166 return base::FeatureList::IsEnabled(kSSLCommonNameMismatchHandling); |
| 168 } | 167 } |
| 169 | 168 |
| 170 // Configuration for SSLErrorHandler. | 169 // Configuration for SSLErrorHandler. |
| 171 class ConfigSingleton : public base::NonThreadSafe { | 170 class ConfigSingleton { |
| 172 public: | 171 public: |
| 173 ConfigSingleton(); | 172 ConfigSingleton(); |
| 174 | 173 |
| 175 base::TimeDelta interstitial_delay() const; | 174 base::TimeDelta interstitial_delay() const; |
| 176 SSLErrorHandler::TimerStartedCallback* timer_started_callback() const; | 175 SSLErrorHandler::TimerStartedCallback* timer_started_callback() const; |
| 177 base::Clock* clock() const; | 176 base::Clock* clock() const; |
| 178 network_time::NetworkTimeTracker* network_time_tracker() const; | 177 network_time::NetworkTimeTracker* network_time_tracker() const; |
| 179 | 178 |
| 180 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) | 179 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 181 // Returns true if any of the SHA256 hashes in |ssl_info| is of a captive | 180 // Returns true if any of the SHA256 hashes in |ssl_info| is of a captive |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 network_time::NetworkTimeTracker* tracker = | 771 network_time::NetworkTimeTracker* tracker = |
| 773 g_config.Pointer()->network_time_tracker(); | 772 g_config.Pointer()->network_time_tracker(); |
| 774 ssl_errors::ClockState clock_state = ssl_errors::GetClockState(now, tracker); | 773 ssl_errors::ClockState clock_state = ssl_errors::GetClockState(now, tracker); |
| 775 if (clock_state == ssl_errors::CLOCK_STATE_FUTURE || | 774 if (clock_state == ssl_errors::CLOCK_STATE_FUTURE || |
| 776 clock_state == ssl_errors::CLOCK_STATE_PAST) { | 775 clock_state == ssl_errors::CLOCK_STATE_PAST) { |
| 777 ShowBadClockInterstitial(now, clock_state); | 776 ShowBadClockInterstitial(now, clock_state); |
| 778 return; // |this| is deleted after showing the interstitial. | 777 return; // |this| is deleted after showing the interstitial. |
| 779 } | 778 } |
| 780 ShowSSLInterstitial(); | 779 ShowSSLInterstitial(); |
| 781 } | 780 } |
| OLD | NEW |