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