| OLD | NEW |
| 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 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_CLIENT_BRIDGE_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_CLIENT_BRIDGE_H_ |
| 6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_CLIENT_BRIDGE_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_CLIENT_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 10 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // its Java peer. Since the Java AwContentsClientBridge can have | 26 // its Java peer. Since the Java AwContentsClientBridge can have |
| 27 // indirect refs from the Application (via callbacks) and so can outlive | 27 // indirect refs from the Application (via callbacks) and so can outlive |
| 28 // webview, this class notifies it before being destroyed and to nullify | 28 // webview, this class notifies it before being destroyed and to nullify |
| 29 // any references. | 29 // any references. |
| 30 class AwContentsClientBridge : public AwContentsClientBridgeBase { | 30 class AwContentsClientBridge : public AwContentsClientBridgeBase { |
| 31 public: | 31 public: |
| 32 AwContentsClientBridge(JNIEnv* env, jobject obj); | 32 AwContentsClientBridge(JNIEnv* env, jobject obj); |
| 33 ~AwContentsClientBridge() override; | 33 ~AwContentsClientBridge() override; |
| 34 | 34 |
| 35 // AwContentsClientBridgeBase implementation | 35 // AwContentsClientBridgeBase implementation |
| 36 void AllowCertificateError(int cert_error, | 36 void AllowCertificateError( |
| 37 net::X509Certificate* cert, | 37 int cert_error, |
| 38 const GURL& request_url, | 38 net::X509Certificate* cert, |
| 39 const base::Callback<void(bool)>& callback, | 39 const GURL& request_url, |
| 40 bool* cancel_request) override; | 40 const base::Callback<void(content::CertificateRequestResultType)>& |
| 41 callback, |
| 42 bool* cancel_request) override; |
| 41 void SelectClientCertificate( | 43 void SelectClientCertificate( |
| 42 net::SSLCertRequestInfo* cert_request_info, | 44 net::SSLCertRequestInfo* cert_request_info, |
| 43 std::unique_ptr<content::ClientCertificateDelegate> delegate) override; | 45 std::unique_ptr<content::ClientCertificateDelegate> delegate) override; |
| 44 | 46 |
| 45 void RunJavaScriptDialog( | 47 void RunJavaScriptDialog( |
| 46 content::JavaScriptMessageType message_type, | 48 content::JavaScriptMessageType message_type, |
| 47 const GURL& origin_url, | 49 const GURL& origin_url, |
| 48 const base::string16& message_text, | 50 const base::string16& message_text, |
| 49 const base::string16& default_prompt_text, | 51 const base::string16& default_prompt_text, |
| 50 const content::JavaScriptDialogManager::DialogClosedCallback& callback) | 52 const content::JavaScriptDialogManager::DialogClosedCallback& callback) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 73 const base::android::JavaRef<jobject>&, | 75 const base::android::JavaRef<jobject>&, |
| 74 int id, | 76 int id, |
| 75 const base::android::JavaRef<jstring>& prompt); | 77 const base::android::JavaRef<jstring>& prompt); |
| 76 void CancelJsResult(JNIEnv*, const base::android::JavaRef<jobject>&, int id); | 78 void CancelJsResult(JNIEnv*, const base::android::JavaRef<jobject>&, int id); |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 void HandleErrorInClientCertificateResponse(int id); | 81 void HandleErrorInClientCertificateResponse(int id); |
| 80 | 82 |
| 81 JavaObjectWeakGlobalRef java_ref_; | 83 JavaObjectWeakGlobalRef java_ref_; |
| 82 | 84 |
| 83 typedef const base::Callback<void(bool)> CertErrorCallback; | 85 typedef const base::Callback<void(content::CertificateRequestResultType)> |
| 86 CertErrorCallback; |
| 84 IDMap<CertErrorCallback, IDMapOwnPointer> pending_cert_error_callbacks_; | 87 IDMap<CertErrorCallback, IDMapOwnPointer> pending_cert_error_callbacks_; |
| 85 IDMap<content::JavaScriptDialogManager::DialogClosedCallback, IDMapOwnPointer> | 88 IDMap<content::JavaScriptDialogManager::DialogClosedCallback, IDMapOwnPointer> |
| 86 pending_js_dialog_callbacks_; | 89 pending_js_dialog_callbacks_; |
| 87 // |pending_client_cert_request_delegates_| owns its pointers, but IDMap | 90 // |pending_client_cert_request_delegates_| owns its pointers, but IDMap |
| 88 // doesn't provide Release, so ownership is managed manually. | 91 // doesn't provide Release, so ownership is managed manually. |
| 89 IDMap<content::ClientCertificateDelegate> | 92 IDMap<content::ClientCertificateDelegate> |
| 90 pending_client_cert_request_delegates_; | 93 pending_client_cert_request_delegates_; |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 bool RegisterAwContentsClientBridge(JNIEnv* env); | 96 bool RegisterAwContentsClientBridge(JNIEnv* env); |
| 94 | 97 |
| 95 } // namespace android_webview | 98 } // namespace android_webview |
| 96 | 99 |
| 97 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_CLIENT_BRIDGE_H_ | 100 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_CLIENT_BRIDGE_H_ |
| OLD | NEW |