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/ssl_error_classification.h" | 26 #include "chrome/browser/ssl/chrome_error_classification.h" | 
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" | 
| 28 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" | 
| 29 #include "components/google/core/browser/google_util.h" | 29 #include "components/google/core/browser/google_util.h" | 
| 30 #include "components/ssl_errors/error_classification.h" | |
| 30 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" | 
| 31 #include "content/public/browser/cert_store.h" | 32 #include "content/public/browser/cert_store.h" | 
| 32 #include "content/public/browser/interstitial_page.h" | 33 #include "content/public/browser/interstitial_page.h" | 
| 33 #include "content/public/browser/interstitial_page_delegate.h" | 34 #include "content/public/browser/interstitial_page_delegate.h" | 
| 34 #include "content/public/browser/navigation_controller.h" | 35 #include "content/public/browser/navigation_controller.h" | 
| 35 #include "content/public/browser/navigation_entry.h" | 36 #include "content/public/browser/navigation_entry.h" | 
| 36 #include "content/public/browser/render_process_host.h" | 37 #include "content/public/browser/render_process_host.h" | 
| 37 #include "content/public/browser/render_view_host.h" | 38 #include "content/public/browser/render_view_host.h" | 
| 38 #include "content/public/browser/signed_certificate_timestamp_store.h" | 39 #include "content/public/browser/signed_certificate_timestamp_store.h" | 
| 39 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" | 
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 ssl_info_(ssl_info), | 183 ssl_info_(ssl_info), | 
| 183 time_triggered_(time_triggered) { | 184 time_triggered_(time_triggered) { | 
| 184 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 185 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 
| 185 reporting_info.metric_prefix = kMetricsName; | 186 reporting_info.metric_prefix = kMetricsName; | 
| 186 set_metrics_helper(new ChromeMetricsHelper(web_contents, request_url, | 187 set_metrics_helper(new ChromeMetricsHelper(web_contents, request_url, | 
| 187 reporting_info, kMetricsName)); | 188 reporting_info, kMetricsName)); | 
| 188 metrics_helper()->RecordUserInteraction( | 189 metrics_helper()->RecordUserInteraction( | 
| 189 security_interstitials::MetricsHelper::TOTAL_VISITS); | 190 security_interstitials::MetricsHelper::TOTAL_VISITS); | 
| 190 | 191 | 
| 191 // TODO(felt): Separate the clock statistics from the main ssl statistics. | 192 // TODO(felt): Separate the clock statistics from the main ssl statistics. | 
| 192 scoped_ptr<SSLErrorClassification> classifier( | 193 scoped_ptr<ChromeErrorClassification> classifier( | 
| 193 new SSLErrorClassification(web_contents, time_triggered_, request_url, | 194 new ChromeErrorClassification(web_contents, time_triggered_, request_url, | 
| 
 
estark
2015/09/23 22:42:19
I think this can just be a ErrorClassification (do
 
 | |
| 194 cert_error_, *ssl_info_.cert.get())); | 195 cert_error_, *ssl_info_.cert.get())); | 
| 195 classifier->RecordUMAStatistics(false); | 196 classifier->RecordUMAStatistics(false); | 
| 196 } | 197 } | 
| 197 | 198 | 
| 198 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { | 199 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { | 
| 199 return true; | 200 return true; | 
| 200 } | 201 } | 
| 201 | 202 | 
| 202 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() | 203 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() | 
| 203 const { | 204 const { | 
| 204 return BadClockBlockingPage::kTypeForTesting; | 205 return BadClockBlockingPage::kTypeForTesting; | 
| (...skipping 23 matching lines...) Expand all Loading... | |
| 228 // Strings for the bad clock warning specifically. | 229 // Strings for the bad clock warning specifically. | 
| 229 load_time_data->SetBoolean("bad_clock", true); | 230 load_time_data->SetBoolean("bad_clock", true); | 
| 230 load_time_data->SetBoolean("overridable", false); | 231 load_time_data->SetBoolean("overridable", false); | 
| 231 #if defined(OS_IOS) | 232 #if defined(OS_IOS) | 
| 232 load_time_data->SetBoolean("hide_primary_button", true); | 233 load_time_data->SetBoolean("hide_primary_button", true); | 
| 233 #else | 234 #else | 
| 234 load_time_data->SetBoolean("hide_primary_button", false); | 235 load_time_data->SetBoolean("hide_primary_button", false); | 
| 235 #endif | 236 #endif | 
| 236 | 237 | 
| 237 int heading_string = | 238 int heading_string = | 
| 238 SSLErrorClassification::IsUserClockInTheFuture(time_triggered_) | 239 ssl_errors::ErrorClassification::IsUserClockInTheFuture(time_triggered_) | 
| 239 ? IDS_CLOCK_ERROR_AHEAD_HEADING | 240 ? IDS_CLOCK_ERROR_AHEAD_HEADING | 
| 240 : IDS_CLOCK_ERROR_BEHIND_HEADING; | 241 : IDS_CLOCK_ERROR_BEHIND_HEADING; | 
| 241 | 242 | 
| 242 load_time_data->SetString("tabTitle", | 243 load_time_data->SetString("tabTitle", | 
| 243 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); | 244 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); | 
| 244 load_time_data->SetString("heading", | 245 load_time_data->SetString("heading", | 
| 245 l10n_util::GetStringUTF16(heading_string)); | 246 l10n_util::GetStringUTF16(heading_string)); | 
| 246 load_time_data->SetString( | 247 load_time_data->SetString( | 
| 247 "primaryParagraph", | 248 "primaryParagraph", | 
| 248 l10n_util::GetStringFUTF16( | 249 l10n_util::GetStringFUTF16( | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 | 355 | 
| 355 void BadClockBlockingPage::NotifyDenyCertificate() { | 356 void BadClockBlockingPage::NotifyDenyCertificate() { | 
| 356 // It's possible that callback_ may not exist if the user clicks "Proceed" | 357 // It's possible that callback_ may not exist if the user clicks "Proceed" | 
| 357 // followed by pressing the back button before the interstitial is hidden. | 358 // followed by pressing the back button before the interstitial is hidden. | 
| 358 // In that case the certificate will still be treated as allowed. | 359 // In that case the certificate will still be treated as allowed. | 
| 359 if (callback_.is_null()) | 360 if (callback_.is_null()) | 
| 360 return; | 361 return; | 
| 361 | 362 | 
| 362 base::ResetAndReturn(&callback_).Run(false); | 363 base::ResetAndReturn(&callback_).Run(false); | 
| 363 } | 364 } | 
| OLD | NEW |