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* FromID(int render_process_id,
41 virtual ~XWalkContentsClientBridgeBase();
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;
49 virtual void RunJavaScriptDialog(
50 content::JavaScriptMessageType message_type,
51 const GURL& origin_url,
52 const base::string16& message_text,
53 const base::string16& default_prompt_text,
54 const content::JavaScriptDialogManager::DialogClosedCallback& callback)
56 virtual void RunBeforeUnloadDialog(
57 const GURL& origin_url,
58 const base::string16& message_text,
59 const content::JavaScriptDialogManager::DialogClosedCallback& callback)
61 virtual void ShowNotification(
62 const content::ShowDesktopNotificationHostMsgParams& params,
67 virtual void UpdateNotificationIcon(
71 virtual void CancelNotification(
80 #endif // XWALK_RUNTIME_BROWSER_ANDROID_XWALK_CONTENTS_CLIENT_BRIDGE_BASE_H_