| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 RecordUMA(WWW_MISMATCH_URL_NOT_AVAILABLE); | 372 RecordUMA(WWW_MISMATCH_URL_NOT_AVAILABLE); |
| 373 ShowSSLInterstitial(); | 373 ShowSSLInterstitial(); |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 void SSLErrorHandler::Observe( | 377 void SSLErrorHandler::Observe( |
| 378 int type, | 378 int type, |
| 379 const content::NotificationSource& source, | 379 const content::NotificationSource& source, |
| 380 const content::NotificationDetails& details) { | 380 const content::NotificationDetails& details) { |
| 381 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 381 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 382 if (type == chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT) { | 382 DCHECK_EQ(chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT, type); |
| 383 timer_.Stop(); | 383 |
| 384 CaptivePortalService::Results* results = | 384 timer_.Stop(); |
| 385 content::Details<CaptivePortalService::Results>(details).ptr(); | 385 CaptivePortalService::Results* results = |
| 386 if (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL) | 386 content::Details<CaptivePortalService::Results>(details).ptr(); |
| 387 ShowCaptivePortalInterstitial(results->landing_url); | 387 if (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL) |
| 388 else | 388 ShowCaptivePortalInterstitial(results->landing_url); |
| 389 ShowSSLInterstitial(); | 389 else |
| 390 } | 390 ShowSSLInterstitial(); |
| 391 #endif | 391 #endif |
| 392 } | 392 } |
| 393 | 393 |
| 394 void SSLErrorHandler::DidStartNavigationToPendingEntry( | 394 void SSLErrorHandler::DidStartNavigationToPendingEntry( |
| 395 const GURL& /* url */, | 395 const GURL& /* url */, |
| 396 content::NavigationController::ReloadType /* reload_type */) { | 396 content::NavigationController::ReloadType /* reload_type */) { |
| 397 // Destroy the error handler on all new navigations. This ensures that the | 397 // Destroy the error handler on all new navigations. This ensures that the |
| 398 // handler is properly recreated when a hanging page is navigated to an SSL | 398 // handler is properly recreated when a hanging page is navigated to an SSL |
| 399 // error, even when the tab's WebContents doesn't change. | 399 // error, even when the tab's WebContents doesn't change. |
| 400 DeleteSSLErrorHandler(); | 400 DeleteSSLErrorHandler(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 411 if (!callback_.is_null()) { | 411 if (!callback_.is_null()) { |
| 412 base::ResetAndReturn(&callback_).Run(false); | 412 base::ResetAndReturn(&callback_).Run(false); |
| 413 } | 413 } |
| 414 if (common_name_mismatch_handler_) { | 414 if (common_name_mismatch_handler_) { |
| 415 common_name_mismatch_handler_->Cancel(); | 415 common_name_mismatch_handler_->Cancel(); |
| 416 common_name_mismatch_handler_.reset(); | 416 common_name_mismatch_handler_.reset(); |
| 417 } | 417 } |
| 418 // Deletes |this| and also destroys the timer. | 418 // Deletes |this| and also destroys the timer. |
| 419 web_contents_->RemoveUserData(UserDataKey()); | 419 web_contents_->RemoveUserData(UserDataKey()); |
| 420 } | 420 } |
| OLD | NEW |