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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/supports_user_data.h"
10 #include "content/public/browser/javascript_dialog_manager.h"
15 class ClientCertificateDelegate
;
20 class SSLCertRequestInfo
;
21 class X509Certificate
;
24 namespace android_webview
{
26 // browser/ layer interface for AwContensClientBridge, as DEPS prevents this
27 // layer from depending on native/ where the implementation lives. The
28 // implementor of the base class plumbs the request to the Java side and
29 // eventually to the webviewclient. This layering hides the details of
30 // native/ from browser/ layer.
31 class AwContentsClientBridgeBase
{
33 // Adds the handler to the UserData registry.
34 static void Associate(content::WebContents
* web_contents
,
35 AwContentsClientBridgeBase
* handler
);
36 static AwContentsClientBridgeBase
* FromWebContents(
37 content::WebContents
* web_contents
);
38 static AwContentsClientBridgeBase
* FromID(int render_process_id
,
41 virtual ~AwContentsClientBridgeBase();
43 virtual void AllowCertificateError(int cert_error
,
44 net::X509Certificate
* cert
,
45 const GURL
& request_url
,
46 const base::Callback
<void(bool)>& callback
,
47 bool* cancel_request
) = 0;
48 virtual void SelectClientCertificate(
49 net::SSLCertRequestInfo
* cert_request_info
,
50 scoped_ptr
<content::ClientCertificateDelegate
> delegate
) = 0;
52 virtual void RunJavaScriptDialog(
53 content::JavaScriptMessageType message_type
,
54 const GURL
& origin_url
,
55 const base::string16
& message_text
,
56 const base::string16
& default_prompt_text
,
57 const content::JavaScriptDialogManager::DialogClosedCallback
& callback
)
60 virtual void RunBeforeUnloadDialog(
61 const GURL
& origin_url
,
62 const base::string16
& message_text
,
63 const content::JavaScriptDialogManager::DialogClosedCallback
& callback
)
66 virtual bool ShouldOverrideUrlLoading(const base::string16
& url
) = 0;
69 } // namespace android_webview
71 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_