Upstream version 6.35.131.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / android / core / src / org / xwalk / core / XWalkWebContentsDelegateAdapter.java
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 package org.xwalk.core;
6
7 import android.util.Log;
8
9 class XWalkWebContentsDelegateAdapter extends XWalkWebContentsDelegate {
10
11     private XWalkContentsClient mXWalkContentsClient;
12
13     public XWalkWebContentsDelegateAdapter(XWalkContentsClient client) {
14         mXWalkContentsClient = client;
15     }
16
17     @Override
18     public void onLoadProgressChanged(int progress) {
19         if (mXWalkContentsClient != null) mXWalkContentsClient.onProgressChanged(progress);
20     }
21
22     @Override
23     public boolean addNewContents(boolean isDialog, boolean isUserGesture) {
24         // TODO: implement.
25         return false;
26     }
27
28     @Override
29     public void closeContents() {
30         if (mXWalkContentsClient != null) mXWalkContentsClient.onCloseWindow();
31     }
32
33     @Override
34     public void activateContents() {
35         // TODO: implement.
36     }
37
38     @Override
39     public void rendererUnresponsive() {
40         if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererUnresponsive();
41     }
42
43     @Override
44     public void rendererResponsive() {
45         if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererResponsive();
46     }
47
48     @Override
49     public void toggleFullscreen(boolean enterFullscreen) {
50         if (mXWalkContentsClient != null) mXWalkContentsClient.onToggleFullscreen(enterFullscreen);
51     }
52
53     @Override
54     public boolean isFullscreen() {
55         if (mXWalkContentsClient != null) return mXWalkContentsClient.hasEnteredFullscreen();
56
57         return false;
58     }
59
60     @Override
61     public boolean shouldOverrideRunFileChooser(int processId, int renderId, int mode,
62             String acceptTypes, boolean capture) {
63         if (mXWalkContentsClient != null) {
64             return mXWalkContentsClient.shouldOverrideRunFileChooser(processId, renderId, mode,
65                     acceptTypes, capture);
66         }
67         return false;
68     }
69 }