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

Unified 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: Disabled gn test Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ssl/ios_ssl_error_handler.mm
diff --git a/ios/chrome/browser/ssl/ios_ssl_error_handler.mm b/ios/chrome/browser/ssl/ios_ssl_error_handler.mm
new file mode 100644
index 0000000000000000000000000000000000000000..180b12c85b61b64e8915ec65025bcbe7a9a468c8
--- /dev/null
+++ b/ios/chrome/browser/ssl/ios_ssl_error_handler.mm
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/ssl/ios_ssl_error_handler.h"
+
+#include "base/bind.h"
+#include "components/security_interstitials/core/ssl_error_ui.h"
+#include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h"
+#import "ios/web/public/navigation_manager.h"
+#import "ios/web/public/web_state/web_state.h"
+#include "net/ssl/ssl_info.h"
+
+IOSSSLErrorHandler::IOSSSLErrorHandler() {}
+IOSSSLErrorHandler::~IOSSSLErrorHandler() {}
+
+/*static*/
+void IOSSSLErrorHandler::HandleSSLError(
+ web::WebState* web_state,
+ int cert_error,
+ const net::SSLInfo& info,
+ const GURL& request_url,
+ bool overridable,
+ const base::Callback<void(bool)>& callback) {
+ 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
+ callback.Run(false);
+ return;
+ }
+
+ int options_mask =
+ overridable ? security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED
+ : security_interstitials::SSLErrorUI::STRICT_ENFORCEMENT;
+ // SSLBlockingPage deletes itself when it's dismissed.
+ auto dismissal_callback(
+ base::Bind(&IOSSSLErrorHandler::InterstitialWasDismissed,
+ base::Unretained(web_state), callback));
+ IOSSSLBlockingPage* page = new IOSSSLBlockingPage(
+ web_state, cert_error, info, request_url, options_mask,
+ base::Time::NowFromSystemTime(), dismissal_callback);
+ page->Show();
+}
+
+/*static*/
+void IOSSSLErrorHandler::InterstitialWasDismissed(
+ web::WebState* web_state,
+ const base::Callback<void(bool)>& callback,
+ bool proceed) {
+ if (!proceed) {
+ web_state->GetNavigationManager()->Reload(true /* check_for_repost */);
+ }
+ callback.Run(proceed);
+}

Powered by Google App Engine
This is Rietveld 408576698