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() {} | |
16 | |
17 /*static*/ | |
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 if (web_state->IsShowingWebInterstitial()) { | |
estark
2016/06/29 23:00:15
Under what conditions would this happen?
Eugene But (OOO till 7-30)
2016/06/30 00:05:26
This is original code, which was written when we s
| |
26 callback.Run(false); | |
27 return; | |
28 } | |
29 | |
30 int options_mask = | |
31 overridable ? security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED | |
32 : security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT; | |
33 // SSLBlockingPage deletes itself when it's dismissed. | |
34 auto dismissal_callback( | |
35 base::Bind(&IOSSSLErrorHandler::InterstitialWasDismissed, | |
36 base::Unretained(web_state), callback)); | |
37 IOSSSLBlockingPage* page = new IOSSSLBlockingPage( | |
38 web_state, cert_error, info, request_url, options_mask, | |
39 base::Time::NowFromSystemTime(), dismissal_callback); | |
40 page->Show(); | |
41 } | |
42 | |
43 /*static*/ | |
44 void IOSSSLErrorHandler::InterstitialWasDismissed( | |
45 web::WebState* web_state, | |
46 const base::Callback<void(bool)>& callback, | |
47 bool proceed) { | |
48 if (!proceed) { | |
49 web_state->GetNavigationManager()->Reload(true /* check_for_repost */); | |
50 } | |
51 callback.Run(proceed); | |
52 } | |
OLD | NEW |