| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_error_handler.h" | 5 #include "chrome/browser/ssl/ssl_error_handler.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 NOTREACHED(); | 193 NOTREACHED(); |
| 194 #endif | 194 #endif |
| 195 } | 195 } |
| 196 | 196 |
| 197 void SSLErrorHandler::ShowSSLInterstitial() { | 197 void SSLErrorHandler::ShowSSLInterstitial() { |
| 198 // Show SSL blocking page. The interstitial owns the blocking page. | 198 // Show SSL blocking page. The interstitial owns the blocking page. |
| 199 RecordUMA(SSLBlockingPage::IsOptionsOverridable(options_mask_) ? | 199 RecordUMA(SSLBlockingPage::IsOptionsOverridable(options_mask_) ? |
| 200 SHOW_SSL_INTERSTITIAL_OVERRIDABLE : | 200 SHOW_SSL_INTERSTITIAL_OVERRIDABLE : |
| 201 SHOW_SSL_INTERSTITIAL_NONOVERRIDABLE); | 201 SHOW_SSL_INTERSTITIAL_NONOVERRIDABLE); |
| 202 (new SSLBlockingPage(web_contents_, cert_error_, ssl_info_, request_url_, | 202 (new SSLBlockingPage(web_contents_, cert_error_, ssl_info_, request_url_, |
| 203 options_mask_, callback_))->Show(); | 203 options_mask_, callback_, |
| 204 base::Time::NowFromSystemTime()))->Show(); |
| 204 // Once an interstitial is displayed, no need to keep the handler around. | 205 // Once an interstitial is displayed, no need to keep the handler around. |
| 205 // This is the equivalent of "delete this". | 206 // This is the equivalent of "delete this". |
| 206 web_contents_->RemoveUserData(UserDataKey()); | 207 web_contents_->RemoveUserData(UserDataKey()); |
| 207 } | 208 } |
| 208 | 209 |
| 209 void SSLErrorHandler::Observe( | 210 void SSLErrorHandler::Observe( |
| 210 int type, | 211 int type, |
| 211 const content::NotificationSource& source, | 212 const content::NotificationSource& source, |
| 212 const content::NotificationDetails& details) { | 213 const content::NotificationDetails& details) { |
| 213 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 214 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 214 if (type == chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT) { | 215 if (type == chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT) { |
| 215 timer_.Stop(); | 216 timer_.Stop(); |
| 216 CaptivePortalService::Results* results = | 217 CaptivePortalService::Results* results = |
| 217 content::Details<CaptivePortalService::Results>(details).ptr(); | 218 content::Details<CaptivePortalService::Results>(details).ptr(); |
| 218 if (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL) | 219 if (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL) |
| 219 ShowCaptivePortalInterstitial(results->landing_url); | 220 ShowCaptivePortalInterstitial(results->landing_url); |
| 220 else | 221 else |
| 221 ShowSSLInterstitial(); | 222 ShowSSLInterstitial(); |
| 222 } | 223 } |
| 223 #endif | 224 #endif |
| 224 } | 225 } |
| OLD | NEW |