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

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: 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/chrome_error_classification.h"
28 #include "chrome/browser/ssl/ssl_cert_reporter.h" 29 #include "chrome/browser/ssl/ssl_cert_reporter.h"
29 #include "chrome/browser/ssl/ssl_error_classification.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/grit/chromium_strings.h" 32 #include "chrome/grit/chromium_strings.h"
33 #include "chrome/grit/generated_resources.h" 33 #include "chrome/grit/generated_resources.h"
34 #include "components/google/core/browser/google_util.h" 34 #include "components/google/core/browser/google_util.h"
35 #include "components/ssl_errors/error_classification.h"
estark 2015/09/23 22:42:19 Do you need to include both, or would chrome_error
35 #include "components/ssl_errors/error_info.h" 36 #include "components/ssl_errors/error_info.h"
36 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/cert_store.h" 38 #include "content/public/browser/cert_store.h"
38 #include "content/public/browser/interstitial_page.h" 39 #include "content/public/browser/interstitial_page.h"
39 #include "content/public/browser/interstitial_page_delegate.h" 40 #include "content/public/browser/interstitial_page_delegate.h"
40 #include "content/public/browser/navigation_controller.h" 41 #include "content/public/browser/navigation_controller.h"
41 #include "content/public/browser/navigation_entry.h" 42 #include "content/public/browser/navigation_entry.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_types.h" 44 #include "content/public/browser/notification_types.h"
44 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 metrics_helper()->RecordUserDecision( 149 metrics_helper()->RecordUserDecision(
149 security_interstitials::MetricsHelper::SHOW); 150 security_interstitials::MetricsHelper::SHOW);
150 metrics_helper()->RecordUserInteraction( 151 metrics_helper()->RecordUserInteraction(
151 security_interstitials::MetricsHelper::TOTAL_VISITS); 152 security_interstitials::MetricsHelper::TOTAL_VISITS);
152 153
153 cert_report_helper_.reset(new CertReportHelper( 154 cert_report_helper_.reset(new CertReportHelper(
154 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, 155 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info,
155 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, 156 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_,
156 metrics_helper())); 157 metrics_helper()));
157 158
158 ssl_error_classification_.reset(new SSLErrorClassification( 159 ssl_error_classification_.reset(
159 web_contents, 160 new ChromeErrorClassification(web_contents, time_triggered_, request_url,
estark 2015/09/23 22:42:19 If you decide to stick with this design (ChromeEC
160 time_triggered_, 161 cert_error_, *ssl_info_.cert.get()));
161 request_url,
162 cert_error_,
163 *ssl_info_.cert.get()));
164 ssl_error_classification_->RecordUMAStatistics(overridable_); 162 ssl_error_classification_->RecordUMAStatistics(overridable_);
165 163
166 // Creating an interstitial without showing (e.g. from chrome://interstitials) 164 // Creating an interstitial without showing (e.g. from chrome://interstitials)
167 // it leaks memory, so don't create it here. 165 // it leaks memory, so don't create it here.
168 } 166 }
169 167
170 bool SSLBlockingPage::ShouldCreateNewNavigation() const { 168 bool SSLBlockingPage::ShouldCreateNewNavigation() const {
171 return true; 169 return true;
172 } 170 }
173 171
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); 227 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON));
230 load_time_data->SetString( 228 load_time_data->SetString(
231 "finalParagraph", 229 "finalParagraph",
232 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url)); 230 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url));
233 } else { 231 } else {
234 load_time_data->SetBoolean("overridable", false); 232 load_time_data->SetBoolean("overridable", false);
235 233
236 ssl_errors::ErrorInfo::ErrorType type = 234 ssl_errors::ErrorInfo::ErrorType type =
237 ssl_errors::ErrorInfo::NetErrorToErrorType(cert_error_); 235 ssl_errors::ErrorInfo::NetErrorToErrorType(cert_error_);
238 if (type == ssl_errors::ErrorInfo::CERT_INVALID && 236 if (type == ssl_errors::ErrorInfo::CERT_INVALID &&
239 SSLErrorClassification::MaybeWindowsLacksSHA256Support()) { 237 ssl_errors::ErrorClassification::MaybeWindowsLacksSHA256Support()) {
240 load_time_data->SetString( 238 load_time_data->SetString(
241 "explanationParagraph", 239 "explanationParagraph",
242 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3, 240 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3,
243 url)); 241 url));
244 } else { 242 } else {
245 load_time_data->SetString( 243 load_time_data->SetString(
246 "explanationParagraph", 244 "explanationParagraph",
247 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url)); 245 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url));
248 } 246 }
249 load_time_data->SetString("primaryButtonText", 247 load_time_data->SetString("primaryButtonText",
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && 453 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) &&
456 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 454 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
457 return is_overridable; 455 return is_overridable;
458 } 456 }
459 457
460 // static 458 // static
461 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( 459 bool SSLBlockingPage::DoesPolicyAllowDangerOverride(
462 const Profile* const profile) { 460 const Profile* const profile) {
463 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 461 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
464 } 462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698