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 XWALK_RUNTIME_BROWSER_ANDROID_XWALK_CONTENTS_CLIENT_BRIDGE_BASE_H_
6 #define XWALK_RUNTIME_BROWSER_ANDROID_XWALK_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"
16 struct ShowDesktopNotificationHostMsgParams;
21 class X509Certificate;
26 // browser/ layer interface for XWalkContentsClientBridge, as DEPS prevents
27 // this 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 XWalkClient. This layering hides the details of
30 // native/ from browser/ layer.
31 class XWalkContentsClientBridgeBase {
33 // Adds the handler to the UserData registry.
34 static void Associate(content::WebContents* web_contents,
35 XWalkContentsClientBridgeBase* handler);
36 static XWalkContentsClientBridgeBase* FromWebContents(
37 content::WebContents* web_contents);
38 static XWalkContentsClientBridgeBase* FromRenderViewID(int render_process_id,
40 static XWalkContentsClientBridgeBase* FromRenderFrameID(int render_process_id,
43 virtual ~XWalkContentsClientBridgeBase();
45 virtual void AllowCertificateError(int cert_error,
46 net::X509Certificate* cert,
47 const GURL& request_url,
48 const base::Callback<void(bool)>& callback,
49 bool* cancel_request) = 0;
51 virtual void RunJavaScriptDialog(
52 content::JavaScriptMessageType message_type,
53 const GURL& origin_url,
54 const base::string16& message_text,
55 const base::string16& default_prompt_text,
56 const content::JavaScriptDialogManager::DialogClosedCallback& callback)
58 virtual void RunBeforeUnloadDialog(
59 const GURL& origin_url,
60 const base::string16& message_text,
61 const content::JavaScriptDialogManager::DialogClosedCallback& callback)
63 virtual void ShowNotification(
64 const content::ShowDesktopNotificationHostMsgParams& params,
69 virtual void UpdateNotificationIcon(
73 virtual void CancelNotification(
82 #endif // XWALK_RUNTIME_BROWSER_ANDROID_XWALK_CONTENTS_CLIENT_BRIDGE_BASE_H_