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

Side by Side Diff: chrome/browser/ssl/bad_clock_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: remove size_t / int mixing Created 5 years, 1 month 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 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/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/i18n/rtl.h" 13 #include "base/i18n/rtl.h"
14 #include "base/i18n/time_formatting.h" 14 #include "base/i18n/time_formatting.h"
15 #include "base/process/launch.h" 15 #include "base/process/launch.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.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/pref_names.h" 29 #include "chrome/common/pref_names.h"
31 #include "chrome/grit/generated_resources.h" 30 #include "chrome/grit/generated_resources.h"
32 #include "components/google/core/browser/google_util.h" 31 #include "components/google/core/browser/google_util.h"
32 #include "components/ssl_errors/error_classification.h"
33 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/cert_store.h" 34 #include "content/public/browser/cert_store.h"
35 #include "content/public/browser/interstitial_page.h" 35 #include "content/public/browser/interstitial_page.h"
36 #include "content/public/browser/interstitial_page_delegate.h" 36 #include "content/public/browser/interstitial_page_delegate.h"
37 #include "content/public/browser/navigation_controller.h" 37 #include "content/public/browser/navigation_controller.h"
38 #include "content/public/browser/navigation_entry.h" 38 #include "content/public/browser/navigation_entry.h"
39 #include "content/public/browser/render_process_host.h" 39 #include "content/public/browser/render_process_host.h"
40 #include "content/public/browser/render_view_host.h" 40 #include "content/public/browser/render_view_host.h"
41 #include "content/public/browser/signed_certificate_timestamp_store.h" 41 #include "content/public/browser/signed_certificate_timestamp_store.h"
42 #include "content/public/browser/web_contents.h" 42 #include "content/public/browser/web_contents.h"
43 #include "content/public/common/renderer_preferences.h" 43 #include "content/public/common/renderer_preferences.h"
44 #include "content/public/common/ssl_status.h" 44 #include "content/public/common/ssl_status.h"
45 #include "grit/browser_resources.h" 45 #include "grit/browser_resources.h"
46 #include "grit/components_strings.h" 46 #include "grit/components_strings.h"
47 #include "net/base/net_errors.h" 47 #include "net/base/net_errors.h"
48 #include "net/base/net_util.h" 48 #include "net/base/net_util.h"
49 #include "net/cert/x509_certificate.h"
49 #include "ui/base/l10n/l10n_util.h" 50 #include "ui/base/l10n/l10n_util.h"
50 51
51 #if defined(OS_ANDROID) 52 #if defined(OS_ANDROID)
52 #include "chrome/browser/android/intent_helper.h" 53 #include "chrome/browser/android/intent_helper.h"
53 #endif 54 #endif
54 55
55 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
56 #include "chrome/browser/profiles/profile_manager.h" 57 #include "chrome/browser/profiles/profile_manager.h"
57 #include "chrome/browser/ui/chrome_pages.h" 58 #include "chrome/browser/ui/chrome_pages.h"
58 #include "chrome/common/url_constants.h" 59 #include "chrome/common/url_constants.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 set_metrics_helper(chrome_metrics_helper.Pass()); 194 set_metrics_helper(chrome_metrics_helper.Pass());
194 metrics_helper()->RecordUserInteraction( 195 metrics_helper()->RecordUserInteraction(
195 security_interstitials::MetricsHelper::TOTAL_VISITS); 196 security_interstitials::MetricsHelper::TOTAL_VISITS);
196 197
197 cert_report_helper_.reset(new CertReportHelper( 198 cert_report_helper_.reset(new CertReportHelper(
198 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, 199 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info,
199 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, 200 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK,
200 false /* overridable */, metrics_helper())); 201 false /* overridable */, metrics_helper()));
201 202
202 // TODO(felt): Separate the clock statistics from the main ssl statistics. 203 // TODO(felt): Separate the clock statistics from the main ssl statistics.
203 SSLErrorClassification classifier(time_triggered_, request_url, cert_error_, 204 ssl_errors::RecordUMAStatistics(false, time_triggered_, request_url,
204 *ssl_info_.cert.get()); 205 cert_error_, *ssl_info_.cert.get());
205 classifier.RecordUMAStatistics(false);
206 } 206 }
207 207
208 bool BadClockBlockingPage::ShouldCreateNewNavigation() const { 208 bool BadClockBlockingPage::ShouldCreateNewNavigation() const {
209 return true; 209 return true;
210 } 210 }
211 211
212 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting() 212 InterstitialPageDelegate::TypeID BadClockBlockingPage::GetTypeForTesting()
213 const { 213 const {
214 return BadClockBlockingPage::kTypeForTesting; 214 return BadClockBlockingPage::kTypeForTesting;
215 } 215 }
(...skipping 22 matching lines...) Expand all
238 238
239 // Strings for the bad clock warning specifically. 239 // Strings for the bad clock warning specifically.
240 load_time_data->SetBoolean("bad_clock", true); 240 load_time_data->SetBoolean("bad_clock", true);
241 load_time_data->SetBoolean("overridable", false); 241 load_time_data->SetBoolean("overridable", false);
242 #if defined(OS_IOS) 242 #if defined(OS_IOS)
243 load_time_data->SetBoolean("hide_primary_button", true); 243 load_time_data->SetBoolean("hide_primary_button", true);
244 #else 244 #else
245 load_time_data->SetBoolean("hide_primary_button", false); 245 load_time_data->SetBoolean("hide_primary_button", false);
246 #endif 246 #endif
247 247
248 int heading_string = 248 int heading_string = ssl_errors::IsUserClockInTheFuture(time_triggered_)
249 SSLErrorClassification::IsUserClockInTheFuture(time_triggered_) 249 ? IDS_CLOCK_ERROR_AHEAD_HEADING
250 ? IDS_CLOCK_ERROR_AHEAD_HEADING 250 : IDS_CLOCK_ERROR_BEHIND_HEADING;
251 : IDS_CLOCK_ERROR_BEHIND_HEADING;
252 251
253 load_time_data->SetString("tabTitle", 252 load_time_data->SetString("tabTitle",
254 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE)); 253 l10n_util::GetStringUTF16(IDS_CLOCK_ERROR_TITLE));
255 load_time_data->SetString("heading", 254 load_time_data->SetString("heading",
256 l10n_util::GetStringUTF16(heading_string)); 255 l10n_util::GetStringUTF16(heading_string));
257 load_time_data->SetString( 256 load_time_data->SetString(
258 "primaryParagraph", 257 "primaryParagraph",
259 l10n_util::GetStringFUTF16( 258 l10n_util::GetStringFUTF16(
260 IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH, url, 259 IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH, url,
261 base::TimeFormatFriendlyDateAndTime(time_triggered_))); 260 base::TimeFormatFriendlyDateAndTime(time_triggered_)));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 373
375 void BadClockBlockingPage::NotifyDenyCertificate() { 374 void BadClockBlockingPage::NotifyDenyCertificate() {
376 // It's possible that callback_ may not exist if the user clicks "Proceed" 375 // It's possible that callback_ may not exist if the user clicks "Proceed"
377 // followed by pressing the back button before the interstitial is hidden. 376 // followed by pressing the back button before the interstitial is hidden.
378 // In that case the certificate will still be treated as allowed. 377 // In that case the certificate will still be treated as allowed.
379 if (callback_.is_null()) 378 if (callback_.is_null())
380 return; 379 return;
381 380
382 base::ResetAndReturn(&callback_).Run(false); 381 base::ResetAndReturn(&callback_).Run(false);
383 } 382 }
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/ssl/common_name_mismatch_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698