Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bad_clock_blocking_page.h" | 5 #include "chrome/browser/ssl/bad_clock_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" | 
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" | 
| 12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" | 
| 13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" | 
| 14 #include "base/process/launch.h" | 14 #include "base/process/launch.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/interstitials/chrome_metrics_helper.h" | 23 #include "chrome/browser/interstitials/chrome_metrics_helper.h" | 
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" | 
| 25 #include "chrome/browser/renderer_preferences_util.h" | 25 #include "chrome/browser/renderer_preferences_util.h" | 
| 26 #include "chrome/browser/ssl/cert_report_helper.h" | 26 #include "chrome/browser/ssl/cert_report_helper.h" | 
| 27 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 27 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 
| 28 #include "chrome/browser/ssl/ssl_error_classification.h" | |
| 29 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" | 
| 30 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" | 
| 31 #include "components/google/core/browser/google_util.h" | 30 #include "components/google/core/browser/google_util.h" | 
| 31 #include "components/ssl_errors/error_classification.h" | |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" | 
| 33 #include "content/public/browser/cert_store.h" | 33 #include "content/public/browser/cert_store.h" | 
| 34 #include "content/public/browser/interstitial_page.h" | 34 #include "content/public/browser/interstitial_page.h" | 
| 35 #include "content/public/browser/interstitial_page_delegate.h" | 35 #include "content/public/browser/interstitial_page_delegate.h" | 
| 36 #include "content/public/browser/navigation_controller.h" | 36 #include "content/public/browser/navigation_controller.h" | 
| 37 #include "content/public/browser/navigation_entry.h" | 37 #include "content/public/browser/navigation_entry.h" | 
| 38 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" | 
| 39 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" | 
| 40 #include "content/public/browser/signed_certificate_timestamp_store.h" | 40 #include "content/public/browser/signed_certificate_timestamp_store.h" | 
| 41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 set_metrics_helper(chrome_metrics_helper.Pass()); | 192 set_metrics_helper(chrome_metrics_helper.Pass()); | 
| 193 metrics_helper()->RecordUserInteraction( | 193 metrics_helper()->RecordUserInteraction( | 
| 194 security_interstitials::MetricsHelper::TOTAL_VISITS); | 194 security_interstitials::MetricsHelper::TOTAL_VISITS); | 
| 195 | 195 | 
| 196 cert_report_helper_.reset(new CertReportHelper( | 196 cert_report_helper_.reset(new CertReportHelper( | 
| 197 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, | 197 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, | 
| 198 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, | 198 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, | 
| 199 false /* overridable */, metrics_helper())); | 199 false /* overridable */, metrics_helper())); | 
| 200 | 200 | 
| 201 // TODO(felt): Separate the clock statistics from the main ssl statistics. | 201 // TODO(felt): Separate the clock statistics from the main ssl statistics. | 
| 202 SSLErrorClassification classifier(time_triggered_, request_url, cert_error_, | 202 ssl_errors::RecordUMAStatistics(false, time_triggered_, request_url, | 
| 
 
estark
2015/10/02 22:17:21
nit: is the 'false' overridable? Can you either ma
 
felt
2015/10/05 05:26:40
I really hate putting comments inline, but this bo
 
 | |
| 203 *ssl_info_.cert.get()); | 203 cert_error_, *ssl_info_.cert.get()); | 
| 204 classifier.RecordUMAStatistics(false); | |
| 205 } | 204 } | 
| 206 | 205 | 
| 207 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { | 206 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { | 
| 208 return true; | 207 return true; | 
| 209 } | 208 } | 
| 210 | 209 | 
| 211 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() | 210 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() | 
| 212 const { | 211 const { | 
| 213 return BadClockBlockingPage::kTypeForTesting; | 212 return BadClockBlockingPage::kTypeForTesting; | 
| 214 } | 213 } | 
| (...skipping 22 matching lines...) Expand all Loading... | |
| 237 | 236 | 
| 238 // Strings for the bad clock warning specifically. | 237 // Strings for the bad clock warning specifically. | 
| 239 load_time_data->SetBoolean("bad_clock", true); | 238 load_time_data->SetBoolean("bad_clock", true); | 
| 240 load_time_data->SetBoolean("overridable", false); | 239 load_time_data->SetBoolean("overridable", false); | 
| 241 #if defined(OS_IOS) | 240 #if defined(OS_IOS) | 
| 242 load_time_data->SetBoolean("hide_primary_button", true); | 241 load_time_data->SetBoolean("hide_primary_button", true); | 
| 243 #else | 242 #else | 
| 244 load_time_data->SetBoolean("hide_primary_button", false); | 243 load_time_data->SetBoolean("hide_primary_button", false); | 
| 245 #endif | 244 #endif | 
| 246 | 245 | 
| 247 int heading_string = | 246 int heading_string = ssl_errors::IsUserClockInTheFuture(time_triggered_) | 
| 248 SSLErrorClassification::IsUserClockInTheFuture(time_triggered_) | 247 ? IDS_CLOCK_ERROR_AHEAD_HEADING | 
| 249 ? IDS_CLOCK_ERROR_AHEAD_HEADING | 248 : IDS_CLOCK_ERROR_BEHIND_HEADING; | 
| 250 : IDS_CLOCK_ERROR_BEHIND_HEADING; | |
| 251 | 249 | 
| 252 load_time_data->SetString("tabTitle", | 250 load_time_data->SetString("tabTitle", | 
| 253 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); | 251 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); | 
| 254 load_time_data->SetString("heading", | 252 load_time_data->SetString("heading", | 
| 255 l10n_util::GetStringUTF16(heading_string)); | 253 l10n_util::GetStringUTF16(heading_string)); | 
| 256 load_time_data->SetString( | 254 load_time_data->SetString( | 
| 257 "primaryParagraph", | 255 "primaryParagraph", | 
| 258 l10n_util::GetStringFUTF16( | 256 l10n_util::GetStringFUTF16( | 
| 259 IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH, url, | 257 IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH, url, | 
| 260 base::TimeFormatFriendlyDateAndTime(time_triggered_))); | 258 base::TimeFormatFriendlyDateAndTime(time_triggered_))); | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 | 371 | 
| 374 void BadClockBlockingPage::NotifyDenyCertificate() { | 372 void BadClockBlockingPage::NotifyDenyCertificate() { | 
| 375 // It's possible that callback_ may not exist if the user clicks "Proceed" | 373 // It's possible that callback_ may not exist if the user clicks "Proceed" | 
| 376 // followed by pressing the back button before the interstitial is hidden. | 374 // followed by pressing the back button before the interstitial is hidden. | 
| 377 // In that case the certificate will still be treated as allowed. | 375 // In that case the certificate will still be treated as allowed. | 
| 378 if (callback_.is_null()) | 376 if (callback_.is_null()) | 
| 379 return; | 377 return; | 
| 380 | 378 | 
| 381 base::ResetAndReturn(&callback_).Run(false); | 379 base::ResetAndReturn(&callback_).Run(false); | 
| 382 } | 380 } | 
| OLD | NEW |