Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ios/chrome/browser/ssl/ios_ssl_error_handler.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "components/security_interstitials/core/ssl_error_ui.h" | |
| 9 #include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h" | |
| 10 #import "ios/web/public/navigation_manager.h" | |
| 11 #import "ios/web/public/web_state/web_state.h" | |
| 12 #include "net/ssl/ssl_info.h" | |
| 13 | |
| 14 IOSSSLErrorHandler::IOSSSLErrorHandler() {} | |
| 15 IOSSSLErrorHandler::~IOSSSLErrorHandler() {} | |
|
sdefresne
2016/06/30 11:58:16
Can you add new line between method definitions?
Eugene But (OOO till 7-30)
2016/06/30 18:35:57
These were removed.
| |
| 16 | |
| 17 /*static*/ | |
|
sdefresne
2016/06/30 11:58:16
"// static" is more common than "/* static */".
Eugene But (OOO till 7-30)
2016/06/30 18:35:57
Done.
| |
| 18 void IOSSSLErrorHandler::HandleSSLError( | |
| 19 web::WebState* web_state, | |
| 20 int cert_error, | |
| 21 const net::SSLInfo& info, | |
| 22 const GURL& request_url, | |
| 23 bool overridable, | |
| 24 const base::Callback<void(bool)>& callback) { | |
| 25 DCHECK(!web_state->IsShowingWebInterstitial()); | |
| 26 | |
| 27 int options_mask = | |
| 28 overridable ? security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED | |
| 29 : security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; | |
| 30 // SSLBlockingPage deletes itself when it's dismissed. | |
| 31 auto dismissal_callback( | |
| 32 base::Bind(&IOSSSLErrorHandler::InterstitialWasDismissed, | |
| 33 base::Unretained(web_state), callback)); | |
| 34 IOSSSLBlockingPage* page = new IOSSSLBlockingPage( | |
| 35 web_state, cert_error, info, request_url, options_mask, | |
| 36 base::Time::NowFromSystemTime(), dismissal_callback); | |
| 37 page->Show(); | |
| 38 } | |
| 39 | |
| 40 /*static*/ | |
| 41 void IOSSSLErrorHandler::InterstitialWasDismissed( | |
| 42 web::WebState* web_state, | |
| 43 const base::Callback<void(bool)>& callback, | |
| 44 bool proceed) { | |
| 45 if (!proceed) { | |
| 46 web_state->GetNavigationManager()->Reload(true /* check_for_repost */); | |
| 47 } | |
| 48 callback.Run(proceed); | |
| 49 } | |
| OLD | NEW |