| OLD | NEW |
| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "chrome/grit/chromium_strings.h" | 31 #include "chrome/grit/chromium_strings.h" |
| 32 #include "chrome/grit/generated_resources.h" | 32 #include "chrome/grit/generated_resources.h" |
| 33 #include "components/google/core/browser/google_util.h" | 33 #include "components/google/core/browser/google_util.h" |
| 34 #include "components/security_interstitials/core/controller_client.h" |
| 34 #include "components/ssl_errors/error_classification.h" | 35 #include "components/ssl_errors/error_classification.h" |
| 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" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 if (command == "\"pageLoadComplete\"") { | 308 if (command == "\"pageLoadComplete\"") { |
| 308 // content::WaitForRenderFrameReady sends this message when the page | 309 // content::WaitForRenderFrameReady sends this message when the page |
| 309 // load completes. Ignore it. | 310 // load completes. Ignore it. |
| 310 return; | 311 return; |
| 311 } | 312 } |
| 312 | 313 |
| 313 int cmd = 0; | 314 int cmd = 0; |
| 314 bool retval = base::StringToInt(command, &cmd); | 315 bool retval = base::StringToInt(command, &cmd); |
| 315 DCHECK(retval); | 316 DCHECK(retval); |
| 316 switch (cmd) { | 317 switch (cmd) { |
| 317 case CMD_DONT_PROCEED: { | 318 case security_interstitials::CMD_DONT_PROCEED: { |
| 318 interstitial_page()->DontProceed(); | 319 interstitial_page()->DontProceed(); |
| 319 break; | 320 break; |
| 320 } | 321 } |
| 321 case CMD_PROCEED: { | 322 case security_interstitials::CMD_PROCEED: { |
| 322 if (danger_overridable_) { | 323 if (danger_overridable_) { |
| 323 interstitial_page()->Proceed(); | 324 interstitial_page()->Proceed(); |
| 324 } | 325 } |
| 325 break; | 326 break; |
| 326 } | 327 } |
| 327 case CMD_DO_REPORT: { | 328 case security_interstitials::CMD_DO_REPORT: { |
| 328 SetReportingPreference(true); | 329 SetReportingPreference(true); |
| 329 break; | 330 break; |
| 330 } | 331 } |
| 331 case CMD_DONT_REPORT: { | 332 case security_interstitials::CMD_DONT_REPORT: { |
| 332 SetReportingPreference(false); | 333 SetReportingPreference(false); |
| 333 break; | 334 break; |
| 334 } | 335 } |
| 335 case CMD_SHOW_MORE_SECTION: { | 336 case security_interstitials::CMD_SHOW_MORE_SECTION: { |
| 336 metrics_helper()->RecordUserInteraction( | 337 metrics_helper()->RecordUserInteraction( |
| 337 security_interstitials::MetricsHelper::SHOW_ADVANCED); | 338 security_interstitials::MetricsHelper::SHOW_ADVANCED); |
| 338 break; | 339 break; |
| 339 } | 340 } |
| 340 case CMD_OPEN_HELP_CENTER: { | 341 case security_interstitials::CMD_OPEN_HELP_CENTER: { |
| 341 metrics_helper()->RecordUserInteraction( | 342 metrics_helper()->RecordUserInteraction( |
| 342 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); | 343 security_interstitials::MetricsHelper::SHOW_LEARN_MORE); |
| 343 content::NavigationController::LoadURLParams help_page_params( | 344 content::NavigationController::LoadURLParams help_page_params( |
| 344 google_util::AppendGoogleLocaleParam( | 345 google_util::AppendGoogleLocaleParam( |
| 345 GURL(kHelpURL), g_browser_process->GetApplicationLocale())); | 346 GURL(kHelpURL), g_browser_process->GetApplicationLocale())); |
| 346 web_contents()->GetController().LoadURLWithParams(help_page_params); | 347 web_contents()->GetController().LoadURLWithParams(help_page_params); |
| 347 break; | 348 break; |
| 348 } | 349 } |
| 349 case CMD_RELOAD: { | 350 case security_interstitials::CMD_RELOAD: { |
| 350 metrics_helper()->RecordUserInteraction( | 351 metrics_helper()->RecordUserInteraction( |
| 351 security_interstitials::MetricsHelper::RELOAD); | 352 security_interstitials::MetricsHelper::RELOAD); |
| 352 // The interstitial can't refresh itself. | 353 // The interstitial can't refresh itself. |
| 353 web_contents()->GetController().Reload(true); | 354 web_contents()->GetController().Reload(true); |
| 354 break; | 355 break; |
| 355 } | 356 } |
| 356 case CMD_OPEN_REPORTING_PRIVACY: | 357 case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: |
| 357 OpenExtendedReportingPrivacyPolicy(); | 358 OpenExtendedReportingPrivacyPolicy(); |
| 358 break; | 359 break; |
| 359 case CMD_OPEN_DATE_SETTINGS: | 360 case security_interstitials::CMD_OPEN_DATE_SETTINGS: |
| 360 case CMD_OPEN_DIAGNOSTIC: | 361 case security_interstitials::CMD_OPEN_DIAGNOSTIC: |
| 361 // Commands not supported by the SSL interstitial. | 362 // Commands not supported by the SSL interstitial. |
| 362 NOTREACHED() << "Unexpected command: " << command; | 363 NOTREACHED() << "Unexpected command: " << command; |
| 363 } | 364 } |
| 364 } | 365 } |
| 365 | 366 |
| 366 void SSLBlockingPage::OverrideRendererPrefs( | 367 void SSLBlockingPage::OverrideRendererPrefs( |
| 367 content::RendererPreferences* prefs) { | 368 content::RendererPreferences* prefs) { |
| 368 Profile* profile = Profile::FromBrowserContext( | 369 Profile* profile = Profile::FromBrowserContext( |
| 369 web_contents()->GetBrowserContext()); | 370 web_contents()->GetBrowserContext()); |
| 370 renderer_preferences_util::UpdateFromSystemSettings( | 371 renderer_preferences_util::UpdateFromSystemSettings( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && | 441 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && |
| 441 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 442 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
| 442 return is_overridable; | 443 return is_overridable; |
| 443 } | 444 } |
| 444 | 445 |
| 445 // static | 446 // static |
| 446 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( | 447 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( |
| 447 const Profile* const profile) { | 448 const Profile* const profile) { |
| 448 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 449 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
| 449 } | 450 } |
| OLD | NEW |