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_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ |
6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
10 #include "content/public/browser/javascript_dialog_manager.h" | 10 #include "content/public/browser/javascript_dialog_manager.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace net { | 18 namespace net { |
| 19 class SSLCertRequestInfo; |
19 class X509Certificate; | 20 class X509Certificate; |
20 } | 21 } |
21 | 22 |
22 namespace android_webview { | 23 namespace android_webview { |
23 | 24 |
24 // browser/ layer interface for AwContensClientBridge, as DEPS prevents this | 25 // browser/ layer interface for AwContensClientBridge, as DEPS prevents this |
25 // layer from depending on native/ where the implementation lives. The | 26 // layer from depending on native/ where the implementation lives. The |
26 // implementor of the base class plumbs the request to the Java side and | 27 // implementor of the base class plumbs the request to the Java side and |
27 // eventually to the webviewclient. This layering hides the details of | 28 // eventually to the webviewclient. This layering hides the details of |
28 // native/ from browser/ layer. | 29 // native/ from browser/ layer. |
29 class AwContentsClientBridgeBase { | 30 class AwContentsClientBridgeBase { |
30 public: | 31 public: |
| 32 typedef base::Callback<void(net::X509Certificate*)> SelectCertificateCallback; |
| 33 |
31 // Adds the handler to the UserData registry. | 34 // Adds the handler to the UserData registry. |
32 static void Associate(content::WebContents* web_contents, | 35 static void Associate(content::WebContents* web_contents, |
33 AwContentsClientBridgeBase* handler); | 36 AwContentsClientBridgeBase* handler); |
34 static AwContentsClientBridgeBase* FromWebContents( | 37 static AwContentsClientBridgeBase* FromWebContents( |
35 content::WebContents* web_contents); | 38 content::WebContents* web_contents); |
36 static AwContentsClientBridgeBase* FromID(int render_process_id, | 39 static AwContentsClientBridgeBase* FromID(int render_process_id, |
37 int render_frame_id); | 40 int render_frame_id); |
38 | 41 |
39 virtual ~AwContentsClientBridgeBase(); | 42 virtual ~AwContentsClientBridgeBase(); |
40 | 43 |
41 virtual void AllowCertificateError(int cert_error, | 44 virtual void AllowCertificateError(int cert_error, |
42 net::X509Certificate* cert, | 45 net::X509Certificate* cert, |
43 const GURL& request_url, | 46 const GURL& request_url, |
44 const base::Callback<void(bool)>& callback, | 47 const base::Callback<void(bool)>& callback, |
45 bool* cancel_request) = 0; | 48 bool* cancel_request) = 0; |
| 49 virtual void SelectClientCertificate( |
| 50 net::SSLCertRequestInfo* cert_request_info, |
| 51 const SelectCertificateCallback& callback) = 0; |
46 | 52 |
47 virtual void RunJavaScriptDialog( | 53 virtual void RunJavaScriptDialog( |
48 content::JavaScriptMessageType message_type, | 54 content::JavaScriptMessageType message_type, |
49 const GURL& origin_url, | 55 const GURL& origin_url, |
50 const base::string16& message_text, | 56 const base::string16& message_text, |
51 const base::string16& default_prompt_text, | 57 const base::string16& default_prompt_text, |
52 const content::JavaScriptDialogManager::DialogClosedCallback& callback) | 58 const content::JavaScriptDialogManager::DialogClosedCallback& callback) |
53 = 0; | 59 = 0; |
54 | 60 |
55 virtual void RunBeforeUnloadDialog( | 61 virtual void RunBeforeUnloadDialog( |
56 const GURL& origin_url, | 62 const GURL& origin_url, |
57 const base::string16& message_text, | 63 const base::string16& message_text, |
58 const content::JavaScriptDialogManager::DialogClosedCallback& callback) | 64 const content::JavaScriptDialogManager::DialogClosedCallback& callback) |
59 = 0; | 65 = 0; |
60 | 66 |
61 virtual bool ShouldOverrideUrlLoading(const base::string16& url) = 0; | 67 virtual bool ShouldOverrideUrlLoading(const base::string16& url) = 0; |
62 }; | 68 }; |
63 | 69 |
64 } // namespace android_webview | 70 } // namespace android_webview |
65 | 71 |
66 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ | 72 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ |
OLD | NEW |