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/callback_forward.h"
9 #include "base/supports_user_data.h"
10 #include "content/public/browser/javascript_dialog_manager.h"
19 class X509Certificate
;
22 namespace android_webview
{
24 // browser/ layer interface for AwContensClientBridge, as DEPS prevents this
25 // 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 // eventually to the webviewclient. This layering hides the details of
28 // native/ from browser/ layer.
29 class AwContentsClientBridgeBase
{
31 // Adds the handler to the UserData registry.
32 static void Associate(content::WebContents
* web_contents
,
33 AwContentsClientBridgeBase
* handler
);
34 static AwContentsClientBridgeBase
* FromWebContents(
35 content::WebContents
* web_contents
);
36 static AwContentsClientBridgeBase
* FromID(int render_process_id
,
39 virtual ~AwContentsClientBridgeBase();
41 virtual void AllowCertificateError(int cert_error
,
42 net::X509Certificate
* cert
,
43 const GURL
& request_url
,
44 const base::Callback
<void(bool)>& callback
,
45 bool* cancel_request
) = 0;
47 virtual void RunJavaScriptDialog(
48 content::JavaScriptMessageType message_type
,
49 const GURL
& origin_url
,
50 const string16
& message_text
,
51 const string16
& default_prompt_text
,
52 const content::JavaScriptDialogManager::DialogClosedCallback
& callback
)
54 virtual void RunBeforeUnloadDialog(
55 const GURL
& origin_url
,
56 const string16
& message_text
,
57 const content::JavaScriptDialogManager::DialogClosedCallback
& callback
)
61 } // namespace android_webview
63 #endif // ANDROID_WEBVIEW_BROWSER_AW_CONTENTS_CLIENT_BRIDGE_BASE_H_