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" |
(...skipping 11 matching lines...) Expand all Loading... |
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/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
31 #include "components/google/core/browser/google_util.h" | 31 #include "components/google/core/browser/google_util.h" |
| 32 #include "components/security_interstitials/core/controller_client.h" |
32 #include "components/ssl_errors/error_classification.h" | 33 #include "components/ssl_errors/error_classification.h" |
33 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/cert_store.h" | 35 #include "content/public/browser/cert_store.h" |
35 #include "content/public/browser/interstitial_page.h" | 36 #include "content/public/browser/interstitial_page.h" |
36 #include "content/public/browser/interstitial_page_delegate.h" | 37 #include "content/public/browser/interstitial_page_delegate.h" |
37 #include "content/public/browser/navigation_controller.h" | 38 #include "content/public/browser/navigation_controller.h" |
38 #include "content/public/browser/navigation_entry.h" | 39 #include "content/public/browser/navigation_entry.h" |
39 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
40 #include "content/public/browser/render_view_host.h" | 41 #include "content/public/browser/render_view_host.h" |
41 #include "content/public/browser/signed_certificate_timestamp_store.h" | 42 #include "content/public/browser/signed_certificate_timestamp_store.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (command == "\"pageLoadComplete\"") { | 320 if (command == "\"pageLoadComplete\"") { |
320 // content::WaitForRenderFrameReady sends this message when the page | 321 // content::WaitForRenderFrameReady sends this message when the page |
321 // load completes. Ignore it. | 322 // load completes. Ignore it. |
322 return; | 323 return; |
323 } | 324 } |
324 | 325 |
325 int cmd = 0; | 326 int cmd = 0; |
326 bool retval = base::StringToInt(command, &cmd); | 327 bool retval = base::StringToInt(command, &cmd); |
327 DCHECK(retval); | 328 DCHECK(retval); |
328 switch (cmd) { | 329 switch (cmd) { |
329 case CMD_DONT_PROCEED: | 330 case security_interstitials::CMD_DONT_PROCEED: |
330 interstitial_page()->DontProceed(); | 331 interstitial_page()->DontProceed(); |
331 break; | 332 break; |
332 case CMD_DO_REPORT: | 333 case security_interstitials::CMD_DO_REPORT: |
333 SetReportingPreference(true); | 334 SetReportingPreference(true); |
334 break; | 335 break; |
335 case CMD_DONT_REPORT: | 336 case security_interstitials::CMD_DONT_REPORT: |
336 SetReportingPreference(false); | 337 SetReportingPreference(false); |
337 break; | 338 break; |
338 case CMD_SHOW_MORE_SECTION: | 339 case security_interstitials::CMD_SHOW_MORE_SECTION: |
339 metrics_helper()->RecordUserInteraction( | 340 metrics_helper()->RecordUserInteraction( |
340 security_interstitials::MetricsHelper::SHOW_ADVANCED); | 341 security_interstitials::MetricsHelper::SHOW_ADVANCED); |
341 break; | 342 break; |
342 case CMD_OPEN_DATE_SETTINGS: | 343 case security_interstitials::CMD_OPEN_DATE_SETTINGS: |
343 metrics_helper()->RecordUserInteraction( | 344 metrics_helper()->RecordUserInteraction( |
344 security_interstitials::MetricsHelper::OPEN_TIME_SETTINGS); | 345 security_interstitials::MetricsHelper::OPEN_TIME_SETTINGS); |
345 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, | 346 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE, |
346 base::Bind(&LaunchDateAndTimeSettings)); | 347 base::Bind(&LaunchDateAndTimeSettings)); |
347 break; | 348 break; |
348 case CMD_OPEN_REPORTING_PRIVACY: | 349 case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: |
349 OpenExtendedReportingPrivacyPolicy(); | 350 OpenExtendedReportingPrivacyPolicy(); |
350 break; | 351 break; |
351 case CMD_PROCEED: | 352 case security_interstitials::CMD_PROCEED: |
352 case CMD_OPEN_HELP_CENTER: | 353 case security_interstitials::CMD_OPEN_HELP_CENTER: |
353 case CMD_RELOAD: | 354 case security_interstitials::CMD_RELOAD: |
354 case CMD_OPEN_DIAGNOSTIC: | 355 case security_interstitials::CMD_OPEN_DIAGNOSTIC: |
355 // Not supported for the bad clock interstitial. | 356 // Not supported for the bad clock interstitial. |
356 NOTREACHED() << "Unexpected command: " << command; | 357 NOTREACHED() << "Unexpected command: " << command; |
357 } | 358 } |
358 } | 359 } |
359 | 360 |
360 void BadClockBlockingPage::OverrideRendererPrefs( | 361 void BadClockBlockingPage::OverrideRendererPrefs( |
361 content::RendererPreferences* prefs) { | 362 content::RendererPreferences* prefs) { |
362 Profile* profile = | 363 Profile* profile = |
363 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 364 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
364 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile, | 365 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile, |
365 web_contents()); | 366 web_contents()); |
366 } | 367 } |
367 | 368 |
368 void BadClockBlockingPage::OnDontProceed() { | 369 void BadClockBlockingPage::OnDontProceed() { |
369 cert_report_helper_->FinishCertCollection( | 370 cert_report_helper_->FinishCertCollection( |
370 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); | 371 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); |
371 NotifyDenyCertificate(); | 372 NotifyDenyCertificate(); |
372 } | 373 } |
373 | 374 |
374 void BadClockBlockingPage::NotifyDenyCertificate() { | 375 void BadClockBlockingPage::NotifyDenyCertificate() { |
375 // It's possible that callback_ may not exist if the user clicks "Proceed" | 376 // 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. | 377 // followed by pressing the back button before the interstitial is hidden. |
377 // In that case the certificate will still be treated as allowed. | 378 // In that case the certificate will still be treated as allowed. |
378 if (callback_.is_null()) | 379 if (callback_.is_null()) |
379 return; | 380 return; |
380 | 381 |
381 base::ResetAndReturn(&callback_).Run(false); | 382 base::ResetAndReturn(&callback_).Run(false); |
382 } | 383 } |
OLD | NEW |