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.
5 package org.xwalk.core.internal;
7 import android.util.Log;
8 import android.view.KeyEvent;
10 class XWalkWebContentsDelegateAdapter extends XWalkWebContentsDelegate {
12 private XWalkContentsClient mXWalkContentsClient;
14 public XWalkWebContentsDelegateAdapter(XWalkContentsClient client) {
15 mXWalkContentsClient = client;
19 public void onLoadProgressChanged(int progress) {
20 if (mXWalkContentsClient != null) mXWalkContentsClient.onProgressChanged(progress);
24 public boolean addNewContents(boolean isDialog, boolean isUserGesture) {
30 public void closeContents() {
31 if (mXWalkContentsClient != null) mXWalkContentsClient.onCloseWindow();
35 public void activateContents() {
40 public void rendererUnresponsive() {
41 if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererUnresponsive();
45 public void rendererResponsive() {
46 if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererResponsive();
50 public void handleKeyboardEvent(KeyEvent event) {
51 // Handle the event here when necessary and return if so.
52 if (mXWalkContentsClient != null) mXWalkContentsClient.onUnhandledKeyEvent(event);
56 public void toggleFullscreen(boolean enterFullscreen) {
57 if (mXWalkContentsClient != null) mXWalkContentsClient.onToggleFullscreen(enterFullscreen);
61 public boolean isFullscreen() {
62 if (mXWalkContentsClient != null) return mXWalkContentsClient.hasEnteredFullscreen();
68 public boolean shouldOverrideRunFileChooser(int processId, int renderId, int mode,
69 String acceptTypes, boolean capture) {
70 if (mXWalkContentsClient != null) {
71 return mXWalkContentsClient.shouldOverrideRunFileChooser(processId, renderId, mode,
72 acceptTypes, capture);