Upstream version 8.36.161.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / android / xwalk_web_contents_delegate.h
1 // Copyright (c) 2013 Intel Corporation. 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.
4
5 #ifndef XWALK_RUNTIME_BROWSER_ANDROID_XWALK_WEB_CONTENTS_DELEGATE_H_
6 #define XWALK_RUNTIME_BROWSER_ANDROID_XWALK_WEB_CONTENTS_DELEGATE_H_
7
8 #include <jni.h>
9
10 #include "components/web_contents_delegate_android/web_contents_delegate_android.h"
11
12 namespace xwalk {
13
14 class XWalkWebContentsDelegate
15     : public web_contents_delegate_android::WebContentsDelegateAndroid {
16  public:
17   XWalkWebContentsDelegate(JNIEnv* env, jobject obj);
18   virtual ~XWalkWebContentsDelegate();
19
20   virtual void AddNewContents(content::WebContents* source,
21                               content::WebContents* new_contents,
22                               WindowOpenDisposition disposition,
23                               const gfx::Rect& initial_pos,
24                               bool user_gesture,
25                               bool* was_blocked) OVERRIDE;
26   virtual void CloseContents(content::WebContents* source) OVERRIDE;
27   virtual void ActivateContents(content::WebContents* contents) OVERRIDE;
28   virtual void UpdatePreferredSize(content::WebContents* web_contents,
29                                    const gfx::Size& pref_size) OVERRIDE;
30   virtual void RunFileChooser(
31       content::WebContents* web_contents,
32       const content::FileChooserParams& params) OVERRIDE;
33   virtual content::JavaScriptDialogManager*
34       GetJavaScriptDialogManager() OVERRIDE;
35
36   virtual void RequestMediaAccessPermission(
37       content::WebContents* web_contents,
38       const content::MediaStreamRequest& request,
39       const content::MediaResponseCallback& callback) OVERRIDE;
40
41   virtual void RendererUnresponsive(content::WebContents* source) OVERRIDE;
42   virtual void RendererResponsive(content::WebContents* source) OVERRIDE;
43
44   virtual void HandleKeyboardEvent(
45       content::WebContents* source,
46       const content::NativeWebKeyboardEvent& event) OVERRIDE;
47
48   virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents,
49                                           bool enter_fullscreen) OVERRIDE;
50   virtual bool IsFullscreenForTabOrPending(
51       const content::WebContents* web_contents) const OVERRIDE;
52
53  private:
54   scoped_ptr<content::JavaScriptDialogManager> javascript_dialog_manager_;
55   DISALLOW_COPY_AND_ASSIGN(XWalkWebContentsDelegate);
56 };
57
58 bool RegisterXWalkWebContentsDelegate(JNIEnv* env);
59
60 }  // namespace xwalk
61
62 #endif  // XWALK_RUNTIME_BROWSER_ANDROID_XWALK_WEB_CONTENTS_DELEGATE_H_