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 "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/time/clock.h" | 11 #include "base/time/clock.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 14 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
15 #include "chrome/browser/ssl/ssl_blocking_page.h" | 15 #include "chrome/browser/ssl/ssl_blocking_page.h" |
16 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 16 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
17 #include "chrome/browser/ssl/ssl_error_classification.h" | 17 #include "chrome/browser/ssl/ssl_error_classification.h" |
18 #include "chrome/browser/ssl/ssl_error_info.h" | 18 #include "components/ssl_errors/error_info.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
21 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
24 | 24 |
25 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 25 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
26 #include "chrome/browser/captive_portal/captive_portal_service.h" | 26 #include "chrome/browser/captive_portal/captive_portal_service.h" |
27 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" | 27 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" |
28 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 28 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 "Enabled"; | 126 "Enabled"; |
127 } | 127 } |
128 #endif | 128 #endif |
129 | 129 |
130 bool IsSSLCommonNameMismatchHandlingEnabled() { | 130 bool IsSSLCommonNameMismatchHandlingEnabled() { |
131 return base::FieldTrialList::FindFullName("SSLCommonNameMismatchHandling") == | 131 return base::FieldTrialList::FindFullName("SSLCommonNameMismatchHandling") == |
132 "Enabled"; | 132 "Enabled"; |
133 } | 133 } |
134 | 134 |
135 bool IsErrorDueToBadClock(const base::Time& now, int error) { | 135 bool IsErrorDueToBadClock(const base::Time& now, int error) { |
136 if (SSLErrorInfo::NetErrorToErrorType(error) != | 136 if (ssl_errors::ErrorInfo::NetErrorToErrorType(error) != |
137 SSLErrorInfo::CERT_DATE_INVALID) { | 137 ssl_errors::ErrorInfo::CERT_DATE_INVALID) { |
138 return false; | 138 return false; |
139 } | 139 } |
140 return SSLErrorClassification::IsUserClockInThePast(now) || | 140 return SSLErrorClassification::IsUserClockInThePast(now) || |
141 SSLErrorClassification::IsUserClockInTheFuture(now); | 141 SSLErrorClassification::IsUserClockInTheFuture(now); |
142 } | 142 } |
143 | 143 |
144 } // namespace | 144 } // namespace |
145 | 145 |
146 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SSLErrorHandler); | 146 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SSLErrorHandler); |
147 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CommonNameMismatchRedirectObserver); | 147 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CommonNameMismatchRedirectObserver); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (!callback_.is_null()) { | 398 if (!callback_.is_null()) { |
399 base::ResetAndReturn(&callback_).Run(false); | 399 base::ResetAndReturn(&callback_).Run(false); |
400 } | 400 } |
401 if (common_name_mismatch_handler_) { | 401 if (common_name_mismatch_handler_) { |
402 common_name_mismatch_handler_->Cancel(); | 402 common_name_mismatch_handler_->Cancel(); |
403 common_name_mismatch_handler_.reset(); | 403 common_name_mismatch_handler_.reset(); |
404 } | 404 } |
405 // Deletes |this| and also destroys the timer. | 405 // Deletes |this| and also destroys the timer. |
406 web_contents_->RemoveUserData(UserDataKey()); | 406 web_contents_->RemoveUserData(UserDataKey()); |
407 } | 407 } |
OLD | NEW |