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

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

Issue 1117173004: Split cert reporter class into report building/serializing and sending (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move //c/b/ssl classes into global namespace Created 5 years, 7 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 (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
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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 const bool enabled = 657 const bool enabled =
657 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled); 658 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled);
658 659
659 if (!enabled) 660 if (!enabled)
660 return; 661 return;
661 662
662 metrics_helper()->RecordUserInteraction( 663 metrics_helper()->RecordUserInteraction(
663 SecurityInterstitialMetricsHelper::EXTENDED_REPORTING_IS_ENABLED); 664 SecurityInterstitialMetricsHelper::EXTENDED_REPORTING_IS_ENABLED);
664 665
665 if (ShouldReportCertificateError()) { 666 if (ShouldReportCertificateError()) {
666 ssl_cert_reporter_->ReportInvalidCertificateChain(request_url().host(), 667 std::string serialized_report;
667 ssl_info_); 668 CertificateErrorReport report(request_url().host(), ssl_info_);
669
670 if (!report.Serialize(&serialized_report)) {
671 LOG(ERROR) << "Failed to serialize certificate report.";
672 return;
673 }
674
675 ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report);
668 } 676 }
669 } 677 }
670 678
671 bool SSLBlockingPage::ShouldShowCertificateReporterCheckbox() { 679 bool SSLBlockingPage::ShouldShowCertificateReporterCheckbox() {
672 #if defined(OS_IOS) 680 #if defined(OS_IOS)
673 return false; 681 return false;
674 #else 682 #else
675 // Only show the checkbox iff the user is part of the respective Finch group 683 // 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. 684 // and the window is not incognito and the feature is not disabled by policy.
677 const bool in_incognito = 685 const bool in_incognito =
(...skipping 28 matching lines...) Expand all
706 714
707 // static 715 // static
708 bool SSLBlockingPage::IsOverridable(int options_mask, 716 bool SSLBlockingPage::IsOverridable(int options_mask,
709 const Profile* const profile) { 717 const Profile* const profile) {
710 const bool is_overridable = 718 const bool is_overridable =
711 (options_mask & SSLBlockingPage::OVERRIDABLE) && 719 (options_mask & SSLBlockingPage::OVERRIDABLE) &&
712 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && 720 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) &&
713 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 721 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
714 return is_overridable; 722 return is_overridable;
715 } 723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698