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 report.Serialize(&serialized_report); |
| 671 ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report); |
668 } | 672 } |
669 } | 673 } |
670 | 674 |
671 bool SSLBlockingPage::ShouldShowCertificateReporterCheckbox() { | 675 bool SSLBlockingPage::ShouldShowCertificateReporterCheckbox() { |
672 // Only show the checkbox iff the user is part of the respective Finch group | 676 // Only show the checkbox iff the user is part of the respective Finch group |
673 // and the window is not incognito and the feature is not disabled by policy. | 677 // and the window is not incognito and the feature is not disabled by policy. |
674 const bool in_incognito = | 678 const bool in_incognito = |
675 web_contents()->GetBrowserContext()->IsOffTheRecord(); | 679 web_contents()->GetBrowserContext()->IsOffTheRecord(); |
676 return base::FieldTrialList::FindFullName( | 680 return base::FieldTrialList::FindFullName( |
677 kHTTPSErrorReporterFinchExperimentName) == | 681 kHTTPSErrorReporterFinchExperimentName) == |
(...skipping 22 matching lines...) Expand all Loading... |
700 | 704 |
701 // static | 705 // static |
702 bool SSLBlockingPage::IsOverridable(int options_mask, | 706 bool SSLBlockingPage::IsOverridable(int options_mask, |
703 const Profile* const profile) { | 707 const Profile* const profile) { |
704 const bool is_overridable = | 708 const bool is_overridable = |
705 (options_mask & SSLBlockingPage::OVERRIDABLE) && | 709 (options_mask & SSLBlockingPage::OVERRIDABLE) && |
706 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && | 710 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && |
707 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 711 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
708 return is_overridable; | 712 return is_overridable; |
709 } | 713 } |
OLD | NEW |