| 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/build_time.h" | 7 #include "base/build_time.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace | 219 } // namespace |
| 220 | 220 |
| 221 // Note that we always create a navigation entry with SSL errors. | 221 // Note that we always create a navigation entry with SSL errors. |
| 222 // No error happening loading a sub-resource triggers an interstitial so far. | 222 // No error happening loading a sub-resource triggers an interstitial so far. |
| 223 SSLBlockingPage::SSLBlockingPage( | 223 SSLBlockingPage::SSLBlockingPage( |
| 224 content::WebContents* web_contents, | 224 content::WebContents* web_contents, |
| 225 bool create_interstitial, |
| 225 int cert_error, | 226 int cert_error, |
| 226 const net::SSLInfo& ssl_info, | 227 const net::SSLInfo& ssl_info, |
| 227 const GURL& request_url, | 228 const GURL& request_url, |
| 228 bool overridable, | 229 bool overridable, |
| 229 bool strict_enforcement, | 230 bool strict_enforcement, |
| 230 const base::Callback<void(bool)>& callback) | 231 const base::Callback<void(bool)>& callback) |
| 231 : callback_(callback), | 232 : callback_(callback), |
| 232 web_contents_(web_contents), | 233 web_contents_(web_contents), |
| 233 cert_error_(cert_error), | 234 cert_error_(cert_error), |
| 234 ssl_info_(ssl_info), | 235 ssl_info_(ssl_info), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 272 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 272 CaptivePortalService* captive_portal_service = | 273 CaptivePortalService* captive_portal_service = |
| 273 CaptivePortalServiceFactory::GetForProfile(profile); | 274 CaptivePortalServiceFactory::GetForProfile(profile); |
| 274 captive_portal_detection_enabled_ = captive_portal_service ->enabled(); | 275 captive_portal_detection_enabled_ = captive_portal_service ->enabled(); |
| 275 captive_portal_service ->DetectCaptivePortal(); | 276 captive_portal_service ->DetectCaptivePortal(); |
| 276 registrar_.Add(this, | 277 registrar_.Add(this, |
| 277 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, | 278 chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, |
| 278 content::Source<Profile>(profile)); | 279 content::Source<Profile>(profile)); |
| 279 #endif | 280 #endif |
| 280 | 281 |
| 281 interstitial_page_ = InterstitialPage::Create( | 282 // chrome://interstitials page uses this class without actually creating an |
| 282 web_contents_, true, request_url, this); | 283 // interstitial so that it can be debugged. Set |create_interstitial| to true |
| 283 interstitial_page_->Show(); | 284 // if the page is going to be used as an actual interstitial and not just part |
| 285 // of the chrome://interstitials webui. |
| 286 if (create_interstitial) { |
| 287 interstitial_page_ = InterstitialPage::Create( |
| 288 web_contents_, true, request_url, this); |
| 289 interstitial_page_->Show(); |
| 290 } |
| 284 } | 291 } |
| 285 | 292 |
| 286 SSLBlockingPage::~SSLBlockingPage() { | 293 SSLBlockingPage::~SSLBlockingPage() { |
| 287 if (!callback_.is_null()) { | 294 if (!callback_.is_null()) { |
| 288 RecordSSLBlockingPageDetailedStats(false, | 295 RecordSSLBlockingPageDetailedStats(false, |
| 289 cert_error_, | 296 cert_error_, |
| 290 overridable_ && !strict_enforcement_, | 297 overridable_ && !strict_enforcement_, |
| 291 internal_, | 298 internal_, |
| 292 num_visits_, | 299 num_visits_, |
| 293 captive_portal_detection_enabled_, | 300 captive_portal_detection_enabled_, |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 // sure we don't clear the captive portal flag, since the interstitial was | 728 // sure we don't clear the captive portal flag, since the interstitial was |
| 722 // potentially caused by the captive portal. | 729 // potentially caused by the captive portal. |
| 723 captive_portal_detected_ = captive_portal_detected_ || | 730 captive_portal_detected_ = captive_portal_detected_ || |
| 724 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 731 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
| 725 // Also keep track of non-HTTP portals and error cases. | 732 // Also keep track of non-HTTP portals and error cases. |
| 726 captive_portal_no_response_ = captive_portal_no_response_ || | 733 captive_portal_no_response_ = captive_portal_no_response_ || |
| 727 (results->result == captive_portal::RESULT_NO_RESPONSE); | 734 (results->result == captive_portal::RESULT_NO_RESPONSE); |
| 728 } | 735 } |
| 729 #endif | 736 #endif |
| 730 } | 737 } |
| OLD | NEW |