OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
6 | 6 |
7 #include "base/build_time.h" | 7 #include "base/build_time.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 ssl_info_.cert.get(), web_contents()->GetRenderProcessHost()->GetID()); | 442 ssl_info_.cert.get(), web_contents()->GetRenderProcessHost()->GetID()); |
443 DCHECK(cert_id); | 443 DCHECK(cert_id); |
444 | 444 |
445 entry->GetSSL().security_style = | 445 entry->GetSSL().security_style = |
446 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 446 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
447 entry->GetSSL().cert_id = cert_id; | 447 entry->GetSSL().cert_id = cert_id; |
448 entry->GetSSL().cert_status = ssl_info_.cert_status; | 448 entry->GetSSL().cert_status = ssl_info_.cert_status; |
449 entry->GetSSL().security_bits = ssl_info_.security_bits; | 449 entry->GetSSL().security_bits = ssl_info_.security_bits; |
450 } | 450 } |
451 | 451 |
452 // This handles the commands sent from the interstitial JavaScript. They are | 452 // This handles the commands sent from the interstitial JavaScript. |
453 // defined in chrome/browser/resources/ssl/ssl_errors_common.js. | |
454 // DO NOT reorder or change this logic without also changing the JavaScript! | 453 // DO NOT reorder or change this logic without also changing the JavaScript! |
455 void SSLBlockingPage::CommandReceived(const std::string& command) { | 454 void SSLBlockingPage::CommandReceived(const std::string& command) { |
456 int cmd = 0; | 455 int cmd = 0; |
457 bool retval = base::StringToInt(command, &cmd); | 456 bool retval = base::StringToInt(command, &cmd); |
458 DCHECK(retval); | 457 DCHECK(retval); |
459 switch (cmd) { | 458 switch (cmd) { |
460 case CMD_DONT_PROCEED: { | 459 case CMD_DONT_PROCEED: { |
461 interstitial_page()->DontProceed(); | 460 interstitial_page()->DontProceed(); |
462 break; | 461 break; |
463 } | 462 } |
464 case CMD_PROCEED: { | 463 case CMD_PROCEED: { |
465 if (danger_overridable_) { | 464 if (danger_overridable_) { |
466 interstitial_page()->Proceed(); | 465 interstitial_page()->Proceed(); |
467 } | 466 } |
468 break; | 467 break; |
469 } | 468 } |
470 case CMD_MORE: { | 469 case CMD_SHOW_MORE_SECTION: { |
471 metrics_helper_->RecordUserInteraction( | 470 metrics_helper_->RecordUserInteraction( |
472 SecurityInterstitialMetricsHelper::SHOW_ADVANCED); | 471 SecurityInterstitialMetricsHelper::SHOW_ADVANCED); |
473 break; | 472 break; |
474 } | 473 } |
475 case CMD_RELOAD: { | 474 case CMD_OPEN_HELP_CENTER: { |
476 metrics_helper_->RecordUserInteraction( | |
477 SecurityInterstitialMetricsHelper::RELOAD); | |
478 // The interstitial can't refresh itself. | |
479 web_contents()->GetController().Reload(true); | |
480 break; | |
481 } | |
482 case CMD_HELP: { | |
483 metrics_helper_->RecordUserInteraction( | 475 metrics_helper_->RecordUserInteraction( |
484 SecurityInterstitialMetricsHelper::SHOW_LEARN_MORE); | 476 SecurityInterstitialMetricsHelper::SHOW_LEARN_MORE); |
485 content::NavigationController::LoadURLParams help_page_params( | 477 content::NavigationController::LoadURLParams help_page_params( |
486 google_util::AppendGoogleLocaleParam( | 478 google_util::AppendGoogleLocaleParam( |
487 GURL(kHelpURL), g_browser_process->GetApplicationLocale())); | 479 GURL(kHelpURL), g_browser_process->GetApplicationLocale())); |
488 web_contents()->GetController().LoadURLWithParams(help_page_params); | 480 web_contents()->GetController().LoadURLWithParams(help_page_params); |
489 break; | 481 break; |
490 } | 482 } |
491 case CMD_CLOCK: { | 483 case CMD_RELOAD: { |
484 metrics_helper_->RecordUserInteraction( | |
485 SecurityInterstitialMetricsHelper::RELOAD); | |
486 // The interstitial can't refresh itself. | |
487 web_contents()->GetController().Reload(true); | |
488 break; | |
489 } | |
490 case CMD_OPEN_DATE_SETTINGS: { | |
492 metrics_helper_->RecordUserInteraction( | 491 metrics_helper_->RecordUserInteraction( |
493 SecurityInterstitialMetricsHelper::OPEN_TIME_SETTINGS); | 492 SecurityInterstitialMetricsHelper::OPEN_TIME_SETTINGS); |
494 LaunchDateAndTimeSettings(); | 493 LaunchDateAndTimeSettings(); |
495 break; | 494 break; |
496 } | 495 } |
497 default: { | 496 case CMD_OPEN_DIAGNOSTIC: |
498 NOTREACHED(); | 497 // Google doesn't currently have a transparency report for SSL. |
499 } | 498 case CMD_DO_REPORT: |
499 case CMD_DONT_REPORT: | |
500 case CMD_OPEN_REPORTING_PRIVACY: | |
501 // Chrome doesn't currently do Extended Reporting for SSL. | |
502 NOTREACHED() << "Unexpected command: " << command; | |
Bernhard Bauer
2015/03/11 16:19:20
This changes the semantics from the previous versi
felt
2015/03/11 16:25:21
Yes, I changed my mind and decided a DCHECK would
| |
500 } | 503 } |
501 } | 504 } |
502 | 505 |
503 void SSLBlockingPage::OverrideRendererPrefs( | 506 void SSLBlockingPage::OverrideRendererPrefs( |
504 content::RendererPreferences* prefs) { | 507 content::RendererPreferences* prefs) { |
505 Profile* profile = Profile::FromBrowserContext( | 508 Profile* profile = Profile::FromBrowserContext( |
506 web_contents()->GetBrowserContext()); | 509 web_contents()->GetBrowserContext()); |
507 renderer_preferences_util::UpdateFromSystemSettings( | 510 renderer_preferences_util::UpdateFromSystemSettings( |
508 prefs, profile, web_contents()); | 511 prefs, profile, web_contents()); |
509 } | 512 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 event_name.append(kEventNotOverridable); | 568 event_name.append(kEventNotOverridable); |
566 event_name.append(net::ErrorToString(cert_error_)); | 569 event_name.append(net::ErrorToString(cert_error_)); |
567 return event_name; | 570 return event_name; |
568 } | 571 } |
569 | 572 |
570 // static | 573 // static |
571 bool SSLBlockingPage::IsOptionsOverridable(int options_mask) { | 574 bool SSLBlockingPage::IsOptionsOverridable(int options_mask) { |
572 return (options_mask & SSLBlockingPage::OVERRIDABLE) && | 575 return (options_mask & SSLBlockingPage::OVERRIDABLE) && |
573 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT); | 576 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT); |
574 } | 577 } |
OLD | NEW |