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

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

Issue 1355413003: Move error classification into the ssl_errors component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 5 years, 2 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/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/rand_util.h" 14 #include "base/rand_util.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "chrome/browser/browser_process.h" 22 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/interstitials/chrome_metrics_helper.h" 24 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/renderer_preferences_util.h" 26 #include "chrome/browser/renderer_preferences_util.h"
27 #include "chrome/browser/ssl/cert_report_helper.h" 27 #include "chrome/browser/ssl/cert_report_helper.h"
28 #include "chrome/browser/ssl/ssl_cert_reporter.h" 28 #include "chrome/browser/ssl/ssl_cert_reporter.h"
29 #include "chrome/browser/ssl/ssl_error_classification.h"
30 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
32 #include "chrome/grit/chromium_strings.h" 31 #include "chrome/grit/chromium_strings.h"
33 #include "chrome/grit/generated_resources.h" 32 #include "chrome/grit/generated_resources.h"
34 #include "components/google/core/browser/google_util.h" 33 #include "components/google/core/browser/google_util.h"
34 #include "components/ssl_errors/error_classification.h"
35 #include "components/ssl_errors/error_info.h" 35 #include "components/ssl_errors/error_info.h"
36 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/cert_store.h" 37 #include "content/public/browser/cert_store.h"
38 #include "content/public/browser/interstitial_page.h" 38 #include "content/public/browser/interstitial_page.h"
39 #include "content/public/browser/interstitial_page_delegate.h" 39 #include "content/public/browser/interstitial_page_delegate.h"
40 #include "content/public/browser/navigation_controller.h" 40 #include "content/public/browser/navigation_controller.h"
41 #include "content/public/browser/navigation_entry.h" 41 #include "content/public/browser/navigation_entry.h"
42 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_types.h" 43 #include "content/public/browser/notification_types.h"
44 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 metrics_helper()->RecordUserDecision( 150 metrics_helper()->RecordUserDecision(
151 security_interstitials::MetricsHelper::SHOW); 151 security_interstitials::MetricsHelper::SHOW);
152 metrics_helper()->RecordUserInteraction( 152 metrics_helper()->RecordUserInteraction(
153 security_interstitials::MetricsHelper::TOTAL_VISITS); 153 security_interstitials::MetricsHelper::TOTAL_VISITS);
154 154
155 cert_report_helper_.reset(new CertReportHelper( 155 cert_report_helper_.reset(new CertReportHelper(
156 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, 156 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info,
157 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, 157 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_,
158 metrics_helper())); 158 metrics_helper()));
159 159
160 SSLErrorClassification error_classification( 160 ssl_errors::RecordUMAStatistics(overridable_, time_triggered_, request_url,
161 time_triggered_, request_url, cert_error_, *ssl_info_.cert.get()); 161 cert_error_, *ssl_info_.cert.get());
162 error_classification.RecordUMAStatistics(overridable_);
163 162
164 // Creating an interstitial without showing (e.g. from chrome://interstitials) 163 // Creating an interstitial without showing (e.g. from chrome://interstitials)
165 // it leaks memory, so don't create it here. 164 // it leaks memory, so don't create it here.
166 } 165 }
167 166
168 bool SSLBlockingPage::ShouldCreateNewNavigation() const { 167 bool SSLBlockingPage::ShouldCreateNewNavigation() const {
169 return true; 168 return true;
170 } 169 }
171 170
172 InterstitialPageDelegate::TypeID SSLBlockingPage::GetTypeForTesting() const { 171 InterstitialPageDelegate::TypeID SSLBlockingPage::GetTypeForTesting() const {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 "primaryButtonText", 221 "primaryButtonText",
223 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); 222 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON));
224 load_time_data->SetString( 223 load_time_data->SetString(
225 "finalParagraph", 224 "finalParagraph",
226 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url)); 225 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url));
227 } else { 226 } else {
228 load_time_data->SetBoolean("overridable", false); 227 load_time_data->SetBoolean("overridable", false);
229 228
230 ssl_errors::ErrorInfo::ErrorType type = 229 ssl_errors::ErrorInfo::ErrorType type =
231 ssl_errors::ErrorInfo::NetErrorToErrorType(cert_error_); 230 ssl_errors::ErrorInfo::NetErrorToErrorType(cert_error_);
232 if (type == ssl_errors::ErrorInfo::CERT_INVALID && 231 load_time_data->SetString(
233 SSLErrorClassification::MaybeWindowsLacksSHA256Support()) { 232 "explanationParagraph",
234 load_time_data->SetString( 233 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url));
estark 2015/10/02 22:17:21 What happened to this bit?
felt 2015/10/05 05:26:40 We don't need it anymore since Chrome now provides
235 "explanationParagraph",
236 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3,
237 url));
238 } else {
239 load_time_data->SetString(
240 "explanationParagraph",
241 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url));
242 }
243 load_time_data->SetString("primaryButtonText", 234 load_time_data->SetString("primaryButtonText",
244 l10n_util::GetStringUTF16(IDS_SSL_RELOAD)); 235 l10n_util::GetStringUTF16(IDS_SSL_RELOAD));
245 // Customize the help link depending on the specific error type. 236 // Customize the help link depending on the specific error type.
246 // Only mark as HSTS if none of the more specific error types apply, 237 // Only mark as HSTS if none of the more specific error types apply,
247 // and use INVALID as a fallback if no other string is appropriate. 238 // and use INVALID as a fallback if no other string is appropriate.
248 load_time_data->SetInteger("errorType", type); 239 load_time_data->SetInteger("errorType", type);
249 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; 240 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID;
250 switch (type) { 241 switch (type) {
251 case ssl_errors::ErrorInfo::CERT_REVOKED: 242 case ssl_errors::ErrorInfo::CERT_REVOKED:
252 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; 243 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && 440 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) &&
450 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 441 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
451 return is_overridable; 442 return is_overridable;
452 } 443 }
453 444
454 // static 445 // static
455 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( 446 bool SSLBlockingPage::DoesPolicyAllowDangerOverride(
456 const Profile* const profile) { 447 const Profile* const profile) {
457 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 448 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
458 } 449 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698