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> |
| 8 |
7 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/macros.h" |
8 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
10 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
11 #include "base/time/clock.h" | 14 #include "base/time/clock.h" |
12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
13 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 17 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
15 #include "chrome/browser/ssl/ssl_blocking_page.h" | 18 #include "chrome/browser/ssl/ssl_blocking_page.h" |
16 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 19 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
17 #include "components/ssl_errors/error_classification.h" | 20 #include "components/ssl_errors/error_classification.h" |
(...skipping 13 matching lines...) Expand all Loading... |
31 | 34 |
32 namespace { | 35 namespace { |
33 | 36 |
34 // The delay in milliseconds before displaying the SSL interstitial. | 37 // The delay in milliseconds before displaying the SSL interstitial. |
35 // This can be changed in tests. | 38 // This can be changed in tests. |
36 // - If there is a name mismatch and a suggested URL available result arrives | 39 // - If there is a name mismatch and a suggested URL available result arrives |
37 // during this time, the user is redirected to the suggester URL. | 40 // during this time, the user is redirected to the suggester URL. |
38 // - If a "captive portal detected" result arrives during this time, | 41 // - If a "captive portal detected" result arrives during this time, |
39 // a captive portal interstitial is displayed. | 42 // a captive portal interstitial is displayed. |
40 // - Otherwise, an SSL interstitial is displayed. | 43 // - Otherwise, an SSL interstitial is displayed. |
41 int64 g_interstitial_delay_in_milliseconds = 2000; | 44 int64_t g_interstitial_delay_in_milliseconds = 2000; |
42 | 45 |
43 // Callback to call when the interstitial timer is started. Used for testing. | 46 // Callback to call when the interstitial timer is started. Used for testing. |
44 SSLErrorHandler::TimerStartedCallback* g_timer_started_callback = nullptr; | 47 SSLErrorHandler::TimerStartedCallback* g_timer_started_callback = nullptr; |
45 | 48 |
46 // The clock to use when deciding which error type to display. Used for testing. | 49 // The clock to use when deciding which error type to display. Used for testing. |
47 base::Clock* g_testing_clock = nullptr; | 50 base::Clock* g_testing_clock = nullptr; |
48 | 51 |
49 // Events for UMA. | 52 // Events for UMA. |
50 enum SSLErrorHandlerEvent { | 53 enum SSLErrorHandlerEvent { |
51 HANDLE_ALL, | 54 HANDLE_ALL, |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (!callback_.is_null()) { | 401 if (!callback_.is_null()) { |
399 base::ResetAndReturn(&callback_).Run(false); | 402 base::ResetAndReturn(&callback_).Run(false); |
400 } | 403 } |
401 if (common_name_mismatch_handler_) { | 404 if (common_name_mismatch_handler_) { |
402 common_name_mismatch_handler_->Cancel(); | 405 common_name_mismatch_handler_->Cancel(); |
403 common_name_mismatch_handler_.reset(); | 406 common_name_mismatch_handler_.reset(); |
404 } | 407 } |
405 // Deletes |this| and also destroys the timer. | 408 // Deletes |this| and also destroys the timer. |
406 web_contents_->RemoveUserData(UserDataKey()); | 409 web_contents_->RemoveUserData(UserDataKey()); |
407 } | 410 } |
OLD | NEW |