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

Side by Side Diff: android_webview/native/aw_contents_client_bridge.cc

Issue 427673006: disable WebView SSL exception when command line flag ignore-certificate-errors is given (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "android_webview/native/aw_contents_client_bridge.h" 5 #include "android_webview/native/aw_contents_client_bridge.h"
6 6
7 #include "android_webview/common/devtools_instrumentation.h" 7 #include "android_webview/common/devtools_instrumentation.h"
8 #include "android_webview/native/aw_contents.h" 8 #include "android_webview/native/aw_contents.h"
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/command_line.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/render_view_host.h" 16 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/content_switches.h"
17 #include "crypto/scoped_openssl_types.h" 19 #include "crypto/scoped_openssl_types.h"
18 #include "jni/AwContentsClientBridge_jni.h" 20 #include "jni/AwContentsClientBridge_jni.h"
19 #include "net/android/keystore_openssl.h" 21 #include "net/android/keystore_openssl.h"
20 #include "net/cert/x509_certificate.h" 22 #include "net/cert/x509_certificate.h"
21 #include "net/ssl/openssl_client_key_store.h" 23 #include "net/ssl/openssl_client_key_store.h"
22 #include "net/ssl/ssl_cert_request_info.h" 24 #include "net/ssl/ssl_cert_request_info.h"
23 #include "net/ssl/ssl_client_cert_type.h" 25 #include "net/ssl/ssl_client_cert_type.h"
24 #include "url/gurl.h" 26 #include "url/gurl.h"
25 27
26 using base::android::AttachCurrentThread; 28 using base::android::AttachCurrentThread;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 101 }
100 } 102 }
101 103
102 void AwContentsClientBridge::ProceedSslError(JNIEnv* env, jobject obj, 104 void AwContentsClientBridge::ProceedSslError(JNIEnv* env, jobject obj,
103 jboolean proceed, jint id) { 105 jboolean proceed, jint id) {
104 DCHECK_CURRENTLY_ON(BrowserThread::UI); 106 DCHECK_CURRENTLY_ON(BrowserThread::UI);
105 CertErrorCallback* callback = pending_cert_error_callbacks_.Lookup(id); 107 CertErrorCallback* callback = pending_cert_error_callbacks_.Lookup(id);
106 if (!callback || callback->is_null()) { 108 if (!callback || callback->is_null()) {
107 LOG(WARNING) << "Ignoring unexpected ssl error proceed callback"; 109 LOG(WARNING) << "Ignoring unexpected ssl error proceed callback";
108 return; 110 return;
111 } else if (CommandLine::ForCurrentProcess()->HasSwitch(
mnaganov (inactive) 2014/07/29 08:24:48 It looks like you'll end up with error callbacks p
112 switches::kIgnoreCertificateErrors)) {
113 LOG(WARNING) << "Ignoring unexpected ssl error due to command line flag";
114 return;
109 } 115 }
110 callback->Run(proceed); 116 callback->Run(proceed);
111 pending_cert_error_callbacks_.Remove(id); 117 pending_cert_error_callbacks_.Remove(id);
112 } 118 }
113 119
114 // This method is inspired by SelectClientCertificate() in 120 // This method is inspired by SelectClientCertificate() in
115 // chrome/browser/ui/android/ssl_client_certificate_request.cc 121 // chrome/browser/ui/android/ssl_client_certificate_request.cc
116 void AwContentsClientBridge::SelectClientCertificate( 122 void AwContentsClientBridge::SelectClientCertificate(
117 net::SSLCertRequestInfo* cert_request_info, 123 net::SSLCertRequestInfo* cert_request_info,
118 const SelectCertificateCallback& callback) { 124 const SelectCertificateCallback& callback) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 pending_client_cert_request_callbacks_.Lookup(request_id); 383 pending_client_cert_request_callbacks_.Lookup(request_id);
378 callback->Run(scoped_refptr<net::X509Certificate>()); 384 callback->Run(scoped_refptr<net::X509Certificate>());
379 pending_client_cert_request_callbacks_.Remove(request_id); 385 pending_client_cert_request_callbacks_.Remove(request_id);
380 } 386 }
381 387
382 bool RegisterAwContentsClientBridge(JNIEnv* env) { 388 bool RegisterAwContentsClientBridge(JNIEnv* env) {
383 return RegisterNativesImpl(env); 389 return RegisterNativesImpl(env);
384 } 390 }
385 391
386 } // namespace android_webview 392 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698