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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
11 #include "content/public/browser/certificate_request_result_type.h" | 11 #include "content/public/browser/certificate_request_result_type.h" |
12 #include "content/public/browser/javascript_dialog_manager.h" | 12 #include "content/public/browser/javascript_dialog_manager.h" |
| 13 #include "content/public/browser/resource_request_info.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class ClientCertificateDelegate; | 18 class ClientCertificateDelegate; |
18 class WebContents; | 19 class WebContents; |
19 } | 20 } |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 class SSLCertRequestInfo; | 23 class SSLCertRequestInfo; |
23 class X509Certificate; | 24 class X509Certificate; |
24 } | 25 } |
25 | 26 |
26 namespace android_webview { | 27 namespace android_webview { |
27 | 28 |
28 // browser/ layer interface for AwContensClientBridge, as DEPS prevents this | 29 // browser/ layer interface for AwContensClientBridge, as DEPS prevents this |
29 // layer from depending on native/ where the implementation lives. The | 30 // layer from depending on native/ where the implementation lives. The |
30 // implementor of the base class plumbs the request to the Java side and | 31 // implementor of the base class plumbs the request to the Java side and |
31 // eventually to the webviewclient. This layering hides the details of | 32 // eventually to the webviewclient. This layering hides the details of |
32 // native/ from browser/ layer. | 33 // native/ from browser/ layer. |
33 class AwContentsClientBridgeBase { | 34 class AwContentsClientBridgeBase { |
34 public: | 35 public: |
35 // Adds the handler to the UserData registry. | 36 // Adds the handler to the UserData registry. |
36 static void Associate(content::WebContents* web_contents, | 37 static void Associate(content::WebContents* web_contents, |
37 AwContentsClientBridgeBase* handler); | 38 AwContentsClientBridgeBase* handler); |
38 static AwContentsClientBridgeBase* FromWebContents( | 39 static AwContentsClientBridgeBase* FromWebContents( |
39 content::WebContents* web_contents); | 40 content::WebContents* web_contents); |
| 41 static AwContentsClientBridgeBase* FromWebContentsGetter( |
| 42 const content::ResourceRequestInfo::WebContentsGetter& |
| 43 web_contents_getter); |
40 static AwContentsClientBridgeBase* FromID(int render_process_id, | 44 static AwContentsClientBridgeBase* FromID(int render_process_id, |
41 int render_frame_id); | 45 int render_frame_id); |
42 | 46 |
43 virtual ~AwContentsClientBridgeBase(); | 47 virtual ~AwContentsClientBridgeBase(); |
44 | 48 |
45 virtual void AllowCertificateError( | 49 virtual void AllowCertificateError( |
46 int cert_error, | 50 int cert_error, |
47 net::X509Certificate* cert, | 51 net::X509Certificate* cert, |
48 const GURL& request_url, | 52 const GURL& request_url, |
49 const base::Callback<void(content::CertificateRequestResultType)>& | 53 const base::Callback<void(content::CertificateRequestResultType)>& |
(...skipping 19 matching lines...) Expand all Loading... |
69 virtual bool ShouldOverrideUrlLoading(const base::string16& url, | 73 virtual bool ShouldOverrideUrlLoading(const base::string16& url, |
70 bool has_user_gesture, | 74 bool has_user_gesture, |
71 bool is_redirect, | 75 bool is_redirect, |
72 bool is_main_frame) = 0; | 76 bool is_main_frame) = 0; |
73 | 77 |
74 virtual void NewDownload(const GURL& url, | 78 virtual void NewDownload(const GURL& url, |
75 const std::string& user_agent, | 79 const std::string& user_agent, |
76 const std::string& content_disposition, | 80 const std::string& content_disposition, |
77 const std::string& mime_type, | 81 const std::string& mime_type, |
78 int64_t content_length) = 0; | 82 int64_t content_length) = 0; |
| 83 |
| 84 // Called when a new login request is detected. See the documentation for |
| 85 // WebViewClient.onReceivedLoginRequest for arguments. Note that |account| |
| 86 // may be empty. |
| 87 virtual void NewLoginRequest(const std::string& realm, |
| 88 const std::string& account, |
| 89 const std::string& args) = 0; |
79 }; | 90 }; |
80 | 91 |
81 } // namespace android_webview | 92 } // namespace android_webview |
82 | 93 |
83 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ | 94 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_ |
OLD | NEW |