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.content.Intent;
8 import android.net.Uri;
9 import android.util.Log;
10 import android.view.KeyEvent;
12 class XWalkWebContentsDelegateAdapter extends XWalkWebContentsDelegate {
14 private XWalkContentsClient mXWalkContentsClient;
16 public XWalkWebContentsDelegateAdapter(XWalkContentsClient client) {
17 mXWalkContentsClient = client;
21 public boolean shouldOpenWithDefaultBrowser(String contentUrl) {
22 if (mXWalkContentsClient != null) {
23 return mXWalkContentsClient.shouldOpenWithDefaultBrowser(contentUrl);
29 public void onLoadProgressChanged(int progress) {
30 if (mXWalkContentsClient != null) mXWalkContentsClient.onProgressChanged(progress);
34 public boolean addNewContents(boolean isDialog, boolean isUserGesture) {
40 public void closeContents() {
41 if (mXWalkContentsClient != null) mXWalkContentsClient.onCloseWindow();
45 public void activateContents() {
46 if (mXWalkContentsClient != null) mXWalkContentsClient.onRequestFocus();
50 public void rendererUnresponsive() {
51 if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererUnresponsive();
55 public void rendererResponsive() {
56 if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererResponsive();
60 public void handleKeyboardEvent(KeyEvent event) {
61 // Handle the event here when necessary and return if so.
62 if (mXWalkContentsClient != null) mXWalkContentsClient.onUnhandledKeyEvent(event);
66 public void toggleFullscreen(boolean enterFullscreen) {
67 if (mXWalkContentsClient != null) mXWalkContentsClient.onToggleFullscreen(enterFullscreen);
71 public boolean isFullscreen() {
72 if (mXWalkContentsClient != null) return mXWalkContentsClient.hasEnteredFullscreen();
78 public boolean shouldOverrideRunFileChooser(int processId, int renderId, int mode,
79 String acceptTypes, boolean capture) {
80 if (mXWalkContentsClient != null) {
81 return mXWalkContentsClient.shouldOverrideRunFileChooser(processId, renderId, mode,
82 acceptTypes, capture);