| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/build_time.h" | 9 #include "base/build_time.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/interstitials/security_interstitial_metrics_helper.h" | 28 #include "chrome/browser/interstitials/security_interstitial_metrics_helper.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/renderer_preferences_util.h" | 30 #include "chrome/browser/renderer_preferences_util.h" |
| 31 #include "chrome/browser/ssl/certificate_error_report.h" |
| 31 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 32 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
| 32 #include "chrome/browser/ssl/ssl_error_classification.h" | 33 #include "chrome/browser/ssl/ssl_error_classification.h" |
| 33 #include "chrome/browser/ssl/ssl_error_info.h" | 34 #include "chrome/browser/ssl/ssl_error_info.h" |
| 34 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/grit/chromium_strings.h" | 37 #include "chrome/grit/chromium_strings.h" |
| 37 #include "chrome/grit/generated_resources.h" | 38 #include "chrome/grit/generated_resources.h" |
| 38 #include "components/google/core/browser/google_util.h" | 39 #include "components/google/core/browser/google_util.h" |
| 39 #include "components/variations/variations_associated_data.h" | 40 #include "components/variations/variations_associated_data.h" |
| 40 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 68 #endif | 69 #endif |
| 69 | 70 |
| 70 #if defined(OS_CHROMEOS) | 71 #if defined(OS_CHROMEOS) |
| 71 #include "chrome/browser/profiles/profile_manager.h" | 72 #include "chrome/browser/profiles/profile_manager.h" |
| 72 #include "chrome/browser/ui/chrome_pages.h" | 73 #include "chrome/browser/ui/chrome_pages.h" |
| 73 #include "chrome/common/url_constants.h" | 74 #include "chrome/common/url_constants.h" |
| 74 #endif | 75 #endif |
| 75 | 76 |
| 76 using base::ASCIIToUTF16; | 77 using base::ASCIIToUTF16; |
| 77 using base::TimeTicks; | 78 using base::TimeTicks; |
| 79 using chrome_browser_ssl::CertificateErrorReport; |
| 78 using content::InterstitialPage; | 80 using content::InterstitialPage; |
| 79 using content::InterstitialPageDelegate; | 81 using content::InterstitialPageDelegate; |
| 80 using content::NavigationController; | 82 using content::NavigationController; |
| 81 using content::NavigationEntry; | 83 using content::NavigationEntry; |
| 82 | 84 |
| 83 // Constants for the HTTPSErrorReporter Finch experiment | 85 // Constants for the HTTPSErrorReporter Finch experiment |
| 84 const char kHTTPSErrorReporterFinchExperimentName[] = "ReportCertificateErrors"; | 86 const char kHTTPSErrorReporterFinchExperimentName[] = "ReportCertificateErrors"; |
| 85 const char kHTTPSErrorReporterFinchGroupShowPossiblySend[] = | 87 const char kHTTPSErrorReporterFinchGroupShowPossiblySend[] = |
| 86 "ShowAndPossiblySend"; | 88 "ShowAndPossiblySend"; |
| 87 const char kHTTPSErrorReporterFinchParamName[] = "sendingThreshold"; | 89 const char kHTTPSErrorReporterFinchParamName[] = "sendingThreshold"; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 const bool enabled = | 658 const bool enabled = |
| 657 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled); | 659 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled); |
| 658 | 660 |
| 659 if (!enabled) | 661 if (!enabled) |
| 660 return; | 662 return; |
| 661 | 663 |
| 662 metrics_helper()->RecordUserInteraction( | 664 metrics_helper()->RecordUserInteraction( |
| 663 SecurityInterstitialMetricsHelper::EXTENDED_REPORTING_IS_ENABLED); | 665 SecurityInterstitialMetricsHelper::EXTENDED_REPORTING_IS_ENABLED); |
| 664 | 666 |
| 665 if (ShouldReportCertificateError()) { | 667 if (ShouldReportCertificateError()) { |
| 666 ssl_cert_reporter_->ReportInvalidCertificateChain(request_url().host(), | 668 std::string serialized_report; |
| 667 ssl_info_); | 669 CertificateErrorReport report(request_url().host(), ssl_info_); |
| 670 if (report.Serialize(&serialized_report)) { |
| 671 ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report); |
| 672 } else { |
| 673 LOG(ERROR) << "Failed to serialize certificate report."; |
| 674 } |
| 668 } | 675 } |
| 669 } | 676 } |
| 670 | 677 |
| 671 bool SSLBlockingPage::ShouldShowCertificateReporterCheckbox() { | 678 bool SSLBlockingPage::ShouldShowCertificateReporterCheckbox() { |
| 672 #if defined(OS_IOS) | 679 #if defined(OS_IOS) |
| 673 return false; | 680 return false; |
| 674 #else | 681 #else |
| 675 // Only show the checkbox iff the user is part of the respective Finch group | 682 // Only show the checkbox iff the user is part of the respective Finch group |
| 676 // and the window is not incognito and the feature is not disabled by policy. | 683 // and the window is not incognito and the feature is not disabled by policy. |
| 677 const bool in_incognito = | 684 const bool in_incognito = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 706 | 713 |
| 707 // static | 714 // static |
| 708 bool SSLBlockingPage::IsOverridable(int options_mask, | 715 bool SSLBlockingPage::IsOverridable(int options_mask, |
| 709 const Profile* const profile) { | 716 const Profile* const profile) { |
| 710 const bool is_overridable = | 717 const bool is_overridable = |
| 711 (options_mask & SSLBlockingPage::OVERRIDABLE) && | 718 (options_mask & SSLBlockingPage::OVERRIDABLE) && |
| 712 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && | 719 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && |
| 713 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 720 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
| 714 return is_overridable; | 721 return is_overridable; |
| 715 } | 722 } |
| OLD | NEW |