Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(977)

Side by Side Diff: chrome/browser/ssl/ssl_error_handler.cc

Issue 2620203003: Add initial version of captive portal list checking. (Closed)
Patch Set: More tests and rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 9 #include <utility>
9 10
10 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
11 #include "base/feature_list.h" 12 #include "base/feature_list.h"
13 #include "base/files/file_util.h"
12 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
15 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
16 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
17 #include "base/time/clock.h" 19 #include "base/time/clock.h"
18 #include "base/time/time.h" 20 #include "base/time/time.h"
19 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ssl/bad_clock_blocking_page.h" 23 #include "chrome/browser/ssl/bad_clock_blocking_page.h"
22 #include "chrome/browser/ssl/ssl_blocking_page.h" 24 #include "chrome/browser/ssl/ssl_blocking_page.h"
23 #include "chrome/browser/ssl/ssl_cert_reporter.h" 25 #include "chrome/browser/ssl/ssl_cert_reporter.h"
26 #include "chrome/browser/ssl/ssl_error_assistant.pb.h"
24 #include "chrome/common/features.h" 27 #include "chrome/common/features.h"
28 #include "chrome/grit/browser_resources.h"
25 #include "components/network_time/network_time_tracker.h" 29 #include "components/network_time/network_time_tracker.h"
26 #include "components/ssl_errors/error_classification.h" 30 #include "components/ssl_errors/error_classification.h"
27 #include "components/ssl_errors/error_info.h" 31 #include "components/ssl_errors/error_info.h"
32 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/navigation_handle.h" 33 #include "content/public/browser/navigation_handle.h"
29 #include "content/public/browser/notification_service.h" 34 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
31 #include "content/public/browser/render_frame_host.h" 36 #include "content/public/browser/render_frame_host.h"
32 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
33 #include "net/base/net_errors.h" 38 #include "net/base/net_errors.h"
39 #include "ui/base/resource/resource_bundle.h"
34 40
35 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) 41 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
36 #include "chrome/browser/captive_portal/captive_portal_service.h" 42 #include "chrome/browser/captive_portal/captive_portal_service.h"
37 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" 43 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
38 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 44 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
39 #include "chrome/browser/ssl/captive_portal_blocking_page.h" 45 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
40 #endif 46 #endif
41 47
42 namespace { 48 namespace {
43 49
44 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) 50 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
45 const base::Feature kCaptivePortalInterstitial{ 51 const base::Feature kCaptivePortalInterstitial{
46 "CaptivePortalInterstitial", base::FEATURE_ENABLED_BY_DEFAULT}; 52 "CaptivePortalInterstitial", base::FEATURE_ENABLED_BY_DEFAULT};
53
54 const base::Feature kCaptivePortalCertificateList{
55 "CaptivePortalCertificateList", base::FEATURE_DISABLED_BY_DEFAULT};
47 #endif 56 #endif
48 57
49 const base::Feature kSSLCommonNameMismatchHandling{ 58 const base::Feature kSSLCommonNameMismatchHandling{
50 "SSLCommonNameMismatchHandling", base::FEATURE_ENABLED_BY_DEFAULT}; 59 "SSLCommonNameMismatchHandling", base::FEATURE_ENABLED_BY_DEFAULT};
51 60
52 const char kHistogram[] = "interstitial.ssl_error_handler";
53
54 // Default delay in milliseconds before displaying the SSL interstitial. 61 // Default delay in milliseconds before displaying the SSL interstitial.
55 // This can be changed in tests. 62 // This can be changed in tests.
56 // - If there is a name mismatch and a suggested URL available result arrives 63 // - If there is a name mismatch and a suggested URL available result arrives
57 // during this time, the user is redirected to the suggester URL. 64 // during this time, the user is redirected to the suggester URL.
58 // - If a "captive portal detected" result arrives during this time, 65 // - If a "captive portal detected" result arrives during this time,
59 // a captive portal interstitial is displayed. 66 // a captive portal interstitial is displayed.
60 // - Otherwise, an SSL interstitial is displayed. 67 // - Otherwise, an SSL interstitial is displayed.
61 const int64_t kInterstitialDelayInMilliseconds = 3000; 68 const int64_t kInterstitialDelayInMilliseconds = 3000;
62 69
70 const char kHistogram[] = "interstitial.ssl_error_handler";
71
63 // Adds a message to console after navigation commits and then, deletes itself. 72 // Adds a message to console after navigation commits and then, deletes itself.
64 // Also deletes itself if the navigation is stopped. 73 // Also deletes itself if the navigation is stopped.
65 class CommonNameMismatchRedirectObserver 74 class CommonNameMismatchRedirectObserver
66 : public content::WebContentsObserver, 75 : public content::WebContentsObserver,
67 public content::WebContentsUserData<CommonNameMismatchRedirectObserver> { 76 public content::WebContentsUserData<CommonNameMismatchRedirectObserver> {
68 public: 77 public:
69 static void AddToConsoleAfterNavigation( 78 static void AddToConsoleAfterNavigation(
70 content::WebContents* web_contents, 79 content::WebContents* web_contents,
71 const std::string& request_url_hostname, 80 const std::string& request_url_hostname,
72 const std::string& suggested_url_hostname) { 81 const std::string& suggested_url_hostname) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 128
120 void RecordUMA(SSLErrorHandler::UMAEvent event) { 129 void RecordUMA(SSLErrorHandler::UMAEvent event) {
121 UMA_HISTOGRAM_ENUMERATION(kHistogram, event, 130 UMA_HISTOGRAM_ENUMERATION(kHistogram, event,
122 SSLErrorHandler::SSL_ERROR_HANDLER_EVENT_COUNT); 131 SSLErrorHandler::SSL_ERROR_HANDLER_EVENT_COUNT);
123 } 132 }
124 133
125 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION) 134 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
126 bool IsCaptivePortalInterstitialEnabled() { 135 bool IsCaptivePortalInterstitialEnabled() {
127 return base::FeatureList::IsEnabled(kCaptivePortalInterstitial); 136 return base::FeatureList::IsEnabled(kCaptivePortalInterstitial);
128 } 137 }
138
139 // Reads the SSL error assistant configuration from the resource bundle.
140 void ReadErrorAssistantProtoFromResourceBundle(std::string* binary_pb) {
141 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
142 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
143 bundle.GetRawDataResource(IDR_SSL_ERROR_ASSISTANT_PB).CopyToString(binary_pb);
144 }
145
146 std::unique_ptr<std::unordered_set<std::string>> LoadCaptivePortalCertHashes(
147 const chrome_browser_ssl::SSLErrorAssistantConfig& proto) {
148 std::unique_ptr<std::unordered_set<std::string>> hashes(
149 new std::unordered_set<std::string>());
150 for (const chrome_browser_ssl::CaptivePortalCert& cert :
151 proto.captive_portal_cert()) {
152 hashes.get()->insert(cert.sha256_hash());
153 }
154 return hashes;
155 }
129 #endif 156 #endif
130 157
131 bool IsSSLCommonNameMismatchHandlingEnabled() { 158 bool IsSSLCommonNameMismatchHandlingEnabled() {
132 return base::FeatureList::IsEnabled(kSSLCommonNameMismatchHandling); 159 return base::FeatureList::IsEnabled(kSSLCommonNameMismatchHandling);
133 } 160 }
134 161
135 // Configuration for SSLErrorHandler. 162 // Configuration for SSLErrorHandler.
136 class ConfigSingleton : public base::NonThreadSafe { 163 class ConfigSingleton : public base::NonThreadSafe {
137 public: 164 public:
138 ConfigSingleton(); 165 ConfigSingleton();
139 166
140 base::TimeDelta interstitial_delay() const; 167 base::TimeDelta interstitial_delay() const;
141 SSLErrorHandler::TimerStartedCallback* timer_started_callback() const; 168 SSLErrorHandler::TimerStartedCallback* timer_started_callback() const;
142 base::Clock* clock() const; 169 base::Clock* clock() const;
143 network_time::NetworkTimeTracker* network_time_tracker() const; 170 network_time::NetworkTimeTracker* network_time_tracker() const;
144 171
172 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
173 // Returns true if any of the SHA256 hashes in |ssl_info| is of a captive
174 // portal certificate. The set of captive portal hashes is loaded on first
175 // use.
176 bool IsKnownCaptivePortalCert(const net::SSLInfo& ssl_info);
177 #endif
178
179 // Testing methods:
180 void ResetForTesting();
145 void SetInterstitialDelayForTesting(const base::TimeDelta& delay); 181 void SetInterstitialDelayForTesting(const base::TimeDelta& delay);
146 void SetTimerStartedCallbackForTesting( 182 void SetTimerStartedCallbackForTesting(
147 SSLErrorHandler::TimerStartedCallback* callback); 183 SSLErrorHandler::TimerStartedCallback* callback);
148 void SetClockForTesting(base::Clock* clock); 184 void SetClockForTesting(base::Clock* clock);
149 void SetNetworkTimeTrackerForTesting( 185 void SetNetworkTimeTrackerForTesting(
150 network_time::NetworkTimeTracker* tracker); 186 network_time::NetworkTimeTracker* tracker);
151 187
188 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
189 void SetErrorAssistantProtoForTesting(
190 const chrome_browser_ssl::SSLErrorAssistantConfig& error_assistant_proto);
191 #endif
192
152 private: 193 private:
153 base::TimeDelta interstitial_delay_; 194 base::TimeDelta interstitial_delay_;
154 195
155 // Callback to call when the interstitial timer is started. Used for 196 // Callback to call when the interstitial timer is started. Used for
156 // testing. 197 // testing.
157 SSLErrorHandler::TimerStartedCallback* timer_started_callback_ = nullptr; 198 SSLErrorHandler::TimerStartedCallback* timer_started_callback_ = nullptr;
158 199
159 // The clock to use when deciding which error type to display. Used for 200 // The clock to use when deciding which error type to display. Used for
160 // testing. 201 // testing.
161 base::Clock* testing_clock_ = nullptr; 202 base::Clock* testing_clock_ = nullptr;
162 203
163 network_time::NetworkTimeTracker* network_time_tracker_ = nullptr; 204 network_time::NetworkTimeTracker* network_time_tracker_ = nullptr;
205
206 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
207 // SPKI hashes belonging to certs treated as captive portals. Null until the
208 // first time IsKnownCaptivePortalCert() or SetErrorAssistantProtoForTesting()
209 // is called.
210 std::unique_ptr<std::unordered_set<std::string>> captive_portal_spki_hashes_;
Ryan Sleevi 2017/02/01 22:06:06 Have you considered making/requiring the PB be sor
meacer 2017/02/02 01:56:05 I wanted to avoid requiring the PB be sorted becau
211 #endif
164 }; 212 };
165 213
166 ConfigSingleton::ConfigSingleton() 214 ConfigSingleton::ConfigSingleton()
167 : interstitial_delay_( 215 : interstitial_delay_(
168 base::TimeDelta::FromMilliseconds(kInterstitialDelayInMilliseconds)) { 216 base::TimeDelta::FromMilliseconds(kInterstitialDelayInMilliseconds)) {
169 } 217 }
170 218
171 base::TimeDelta ConfigSingleton::interstitial_delay() const { 219 base::TimeDelta ConfigSingleton::interstitial_delay() const {
172 return interstitial_delay_; 220 return interstitial_delay_;
173 } 221 }
174 222
175 SSLErrorHandler::TimerStartedCallback* ConfigSingleton::timer_started_callback() 223 SSLErrorHandler::TimerStartedCallback* ConfigSingleton::timer_started_callback()
176 const { 224 const {
177 return timer_started_callback_; 225 return timer_started_callback_;
178 } 226 }
179 227
180 network_time::NetworkTimeTracker* ConfigSingleton::network_time_tracker() 228 network_time::NetworkTimeTracker* ConfigSingleton::network_time_tracker()
181 const { 229 const {
182 return network_time_tracker_ ? network_time_tracker_ 230 return network_time_tracker_ ? network_time_tracker_
183 : g_browser_process->network_time_tracker(); 231 : g_browser_process->network_time_tracker();
184 } 232 }
185 233
186 base::Clock* ConfigSingleton::clock() const { 234 base::Clock* ConfigSingleton::clock() const {
187 return testing_clock_; 235 return testing_clock_;
188 } 236 }
189 237
238 void ConfigSingleton::ResetForTesting() {
239 interstitial_delay_ =
240 base::TimeDelta::FromMilliseconds(kInterstitialDelayInMilliseconds);
241 timer_started_callback_ = nullptr;
242 network_time_tracker_ = nullptr;
243 testing_clock_ = nullptr;
244 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
245 captive_portal_spki_hashes_.reset();
246 #endif
247 }
248
190 void ConfigSingleton::SetInterstitialDelayForTesting( 249 void ConfigSingleton::SetInterstitialDelayForTesting(
191 const base::TimeDelta& delay) { 250 const base::TimeDelta& delay) {
192 interstitial_delay_ = delay; 251 interstitial_delay_ = delay;
193 } 252 }
194 253
195 void ConfigSingleton::SetTimerStartedCallbackForTesting( 254 void ConfigSingleton::SetTimerStartedCallbackForTesting(
196 SSLErrorHandler::TimerStartedCallback* callback) { 255 SSLErrorHandler::TimerStartedCallback* callback) {
197 DCHECK(!callback || !callback->is_null()); 256 DCHECK(!callback || !callback->is_null());
198 timer_started_callback_ = callback; 257 timer_started_callback_ = callback;
199 } 258 }
200 259
201 void ConfigSingleton::SetClockForTesting(base::Clock* clock) { 260 void ConfigSingleton::SetClockForTesting(base::Clock* clock) {
202 testing_clock_ = clock; 261 testing_clock_ = clock;
203 } 262 }
204 263
205 void ConfigSingleton::SetNetworkTimeTrackerForTesting( 264 void ConfigSingleton::SetNetworkTimeTrackerForTesting(
206 network_time::NetworkTimeTracker* tracker) { 265 network_time::NetworkTimeTracker* tracker) {
207 network_time_tracker_ = tracker; 266 network_time_tracker_ = tracker;
208 } 267 }
209 268
269 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
270 void ConfigSingleton::SetErrorAssistantProtoForTesting(
271 const chrome_browser_ssl::SSLErrorAssistantConfig& error_assistant_proto) {
272 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
273 DCHECK(!captive_portal_spki_hashes_);
274 captive_portal_spki_hashes_ =
275 LoadCaptivePortalCertHashes(error_assistant_proto);
Ryan Sleevi 2017/02/01 22:06:06 Can resources be loaded on the UI thread? I though
meacer 2017/02/02 01:56:05 This was going to be one of my main questions to y
276 }
277
278 bool ConfigSingleton::IsKnownCaptivePortalCert(const net::SSLInfo& ssl_info) {
279 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
280 if (!captive_portal_spki_hashes_) {
281 std::string binary_proto;
282 ReadErrorAssistantProtoFromResourceBundle(&binary_proto);
283 chrome_browser_ssl::SSLErrorAssistantConfig proto;
284 proto.ParseFromString(binary_proto);
285 captive_portal_spki_hashes_ = LoadCaptivePortalCertHashes(proto);
286 }
287
288 for (const net::HashValue& hash_value : ssl_info.public_key_hashes) {
289 if (hash_value.tag == net::HASH_VALUE_SHA256 &&
290 captive_portal_spki_hashes_->find(hash_value.ToString()) !=
291 captive_portal_spki_hashes_->end()) {
Ryan Sleevi 2017/02/01 22:06:06 nit: I tend to encourage writing fewer compound co
meacer 2017/02/02 01:56:05 Done.
292 return true;
293 }
294 }
295 return false;
296 }
297 #endif
298
210 class SSLErrorHandlerDelegateImpl : public SSLErrorHandler::Delegate { 299 class SSLErrorHandlerDelegateImpl : public SSLErrorHandler::Delegate {
211 public: 300 public:
212 SSLErrorHandlerDelegateImpl( 301 SSLErrorHandlerDelegateImpl(
213 content::WebContents* web_contents, 302 content::WebContents* web_contents,
214 const net::SSLInfo& ssl_info, 303 const net::SSLInfo& ssl_info,
215 Profile* const profile, 304 Profile* const profile,
216 int cert_error, 305 int cert_error,
217 int options_mask, 306 int options_mask,
218 const GURL& request_url, 307 const GURL& request_url,
219 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, 308 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 std::unique_ptr<SSLErrorHandler::Delegate>( 447 std::unique_ptr<SSLErrorHandler::Delegate>(
359 new SSLErrorHandlerDelegateImpl( 448 new SSLErrorHandlerDelegateImpl(
360 web_contents, ssl_info, profile, cert_error, options_mask, 449 web_contents, ssl_info, profile, cert_error, options_mask,
361 request_url, std::move(ssl_cert_reporter), callback)), 450 request_url, std::move(ssl_cert_reporter), callback)),
362 web_contents, profile, cert_error, ssl_info, request_url, callback); 451 web_contents, profile, cert_error, ssl_info, request_url, callback);
363 web_contents->SetUserData(UserDataKey(), error_handler); 452 web_contents->SetUserData(UserDataKey(), error_handler);
364 error_handler->StartHandlingError(); 453 error_handler->StartHandlingError();
365 } 454 }
366 455
367 // static 456 // static
457 void SSLErrorHandler::ResetConfigForTesting() {
458 g_config.Pointer()->ResetForTesting();
459 }
460
461 // static
368 void SSLErrorHandler::SetInterstitialDelayForTesting( 462 void SSLErrorHandler::SetInterstitialDelayForTesting(
369 const base::TimeDelta& delay) { 463 const base::TimeDelta& delay) {
370 g_config.Pointer()->SetInterstitialDelayForTesting(delay); 464 g_config.Pointer()->SetInterstitialDelayForTesting(delay);
371 } 465 }
372 466
373 // static 467 // static
374 void SSLErrorHandler::SetInterstitialTimerStartedCallbackForTesting( 468 void SSLErrorHandler::SetInterstitialTimerStartedCallbackForTesting(
375 TimerStartedCallback* callback) { 469 TimerStartedCallback* callback) {
376 g_config.Pointer()->SetTimerStartedCallbackForTesting(callback); 470 g_config.Pointer()->SetTimerStartedCallbackForTesting(callback);
377 } 471 }
(...skipping 11 matching lines...) Expand all
389 483
390 // static 484 // static
391 std::string SSLErrorHandler::GetHistogramNameForTesting() { 485 std::string SSLErrorHandler::GetHistogramNameForTesting() {
392 return kHistogram; 486 return kHistogram;
393 } 487 }
394 488
395 bool SSLErrorHandler::IsTimerRunningForTesting() const { 489 bool SSLErrorHandler::IsTimerRunningForTesting() const {
396 return timer_.IsRunning(); 490 return timer_.IsRunning();
397 } 491 }
398 492
493 void SSLErrorHandler::SetErrorAssistantProtoForTesting(
494 const chrome_browser_ssl::SSLErrorAssistantConfig& config_proto) {
495 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
496 g_config.Pointer()->SetErrorAssistantProtoForTesting(config_proto);
497 #endif
498 }
499
399 SSLErrorHandler::SSLErrorHandler( 500 SSLErrorHandler::SSLErrorHandler(
400 std::unique_ptr<Delegate> delegate, 501 std::unique_ptr<Delegate> delegate,
401 content::WebContents* web_contents, 502 content::WebContents* web_contents,
402 Profile* profile, 503 Profile* profile,
403 int cert_error, 504 int cert_error,
404 const net::SSLInfo& ssl_info, 505 const net::SSLInfo& ssl_info,
405 const GURL& request_url, 506 const GURL& request_url,
406 const base::Callback<void(content::CertificateRequestResultType)>& callback) 507 const base::Callback<void(content::CertificateRequestResultType)>& callback)
407 : content::WebContentsObserver(web_contents), 508 : content::WebContentsObserver(web_contents),
408 delegate_(std::move(delegate)), 509 delegate_(std::move(delegate)),
(...skipping 10 matching lines...) Expand all
419 520
420 void SSLErrorHandler::StartHandlingError() { 521 void SSLErrorHandler::StartHandlingError() {
421 RecordUMA(HANDLE_ALL); 522 RecordUMA(HANDLE_ALL);
422 523
423 if (ssl_errors::ErrorInfo::NetErrorToErrorType(cert_error_) == 524 if (ssl_errors::ErrorInfo::NetErrorToErrorType(cert_error_) ==
424 ssl_errors::ErrorInfo::CERT_DATE_INVALID) { 525 ssl_errors::ErrorInfo::CERT_DATE_INVALID) {
425 HandleCertDateInvalidError(); 526 HandleCertDateInvalidError();
426 return; 527 return;
427 } 528 }
428 529
530 #if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
531 if (base::FeatureList::IsEnabled(kCaptivePortalCertificateList) &&
532 cert_error_ == net::ERR_CERT_COMMON_NAME_INVALID &&
533 g_config.Pointer()->IsKnownCaptivePortalCert(ssl_info_)) {
534 RecordUMA(CAPTIVE_PORTAL_CERT_FOUND);
535 ShowCaptivePortalInterstitial(
536 GURL(captive_portal::CaptivePortalDetector::kDefaultURL));
537 return;
538 }
539 #endif
540
429 std::vector<std::string> dns_names; 541 std::vector<std::string> dns_names;
430 ssl_info_.cert->GetDNSNames(&dns_names); 542 ssl_info_.cert->GetDNSNames(&dns_names);
431 DCHECK(!dns_names.empty()); 543 DCHECK(!dns_names.empty());
432 GURL suggested_url; 544 GURL suggested_url;
433 if (IsSSLCommonNameMismatchHandlingEnabled() && 545 if (IsSSLCommonNameMismatchHandlingEnabled() &&
434 cert_error_ == net::ERR_CERT_COMMON_NAME_INVALID && 546 cert_error_ == net::ERR_CERT_COMMON_NAME_INVALID &&
435 delegate_->IsErrorOverridable() && 547 delegate_->IsErrorOverridable() &&
436 delegate_->GetSuggestedUrl(dns_names, &suggested_url)) { 548 delegate_->GetSuggestedUrl(dns_names, &suggested_url)) {
437 RecordUMA(WWW_MISMATCH_FOUND); 549 RecordUMA(WWW_MISMATCH_FOUND);
438 net::CertStatus extra_cert_errors = 550 net::CertStatus extra_cert_errors =
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 network_time::NetworkTimeTracker* tracker = 740 network_time::NetworkTimeTracker* tracker =
629 g_config.Pointer()->network_time_tracker(); 741 g_config.Pointer()->network_time_tracker();
630 ssl_errors::ClockState clock_state = ssl_errors::GetClockState(now, tracker); 742 ssl_errors::ClockState clock_state = ssl_errors::GetClockState(now, tracker);
631 if (clock_state == ssl_errors::CLOCK_STATE_FUTURE || 743 if (clock_state == ssl_errors::CLOCK_STATE_FUTURE ||
632 clock_state == ssl_errors::CLOCK_STATE_PAST) { 744 clock_state == ssl_errors::CLOCK_STATE_PAST) {
633 ShowBadClockInterstitial(now, clock_state); 745 ShowBadClockInterstitial(now, clock_state);
634 return; // |this| is deleted after showing the interstitial. 746 return; // |this| is deleted after showing the interstitial.
635 } 747 }
636 ShowSSLInterstitial(); 748 ShowSSLInterstitial();
637 } 749 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698