Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: ios/chrome/browser/ssl/ios_ssl_error_handler.mm

Issue 2108783005: [ios] Implemented iOS analogue of SSLErrorHandler class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "base/callback.h"
9 #include "components/security_interstitials/core/ssl_error_ui.h"
10 #include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h"
11 #import "ios/web/public/navigation_manager.h"
12 #import "ios/web/public/web_state/web_state.h"
13 #include "net/ssl/ssl_info.h"
14
15 // static
16 void IOSSSLErrorHandler::HandleSSLError(
17 web::WebState* web_state,
18 int cert_error,
19 const net::SSLInfo& info,
20 const GURL& request_url,
21 bool overridable,
22 const base::Callback<void(bool)>& callback) {
23 DCHECK(!web_state->IsShowingWebInterstitial());
24
25 int options_mask =
26 overridable ? security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED
27 : security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT;
28 // SSLBlockingPage deletes itself when it's dismissed.
29 auto dismissal_callback(
30 base::Bind(&IOSSSLErrorHandler::InterstitialWasDismissed,
31 base::Unretained(web_state), callback));
32 IOSSSLBlockingPage* page = new IOSSSLBlockingPage(
33 web_state, cert_error, info, request_url, options_mask,
34 base::Time::NowFromSystemTime(), dismissal_callback);
35 page->Show();
36 }
37
38 // static
39 void IOSSSLErrorHandler::InterstitialWasDismissed(
40 web::WebState* web_state,
41 const base::Callback<void(bool)>& callback,
42 bool proceed) {
43 if (!proceed) {
44 web_state->GetNavigationManager()->Reload(true /* check_for_repost */);
45 }
46 callback.Run(proceed);
47 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ssl/ios_ssl_error_handler.h ('k') | ios/chrome/browser/ssl/ios_ssl_error_handler_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698