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) {
35 return mXWalkContentsClient.onCreateWindow(isDialog, isUserGesture);
39 public void closeContents() {
40 if (mXWalkContentsClient != null) mXWalkContentsClient.onCloseWindow();
44 public void activateContents() {
45 if (mXWalkContentsClient != null) mXWalkContentsClient.onRequestFocus();
49 public void rendererUnresponsive() {
50 if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererUnresponsive();
54 public void rendererResponsive() {
55 if (mXWalkContentsClient != null) mXWalkContentsClient.onRendererResponsive();
59 public void handleKeyboardEvent(KeyEvent event) {
60 // Handle the event here when necessary and return if so.
61 if (mXWalkContentsClient != null) mXWalkContentsClient.onUnhandledKeyEvent(event);
65 public void toggleFullscreen(boolean enterFullscreen) {
66 if (mXWalkContentsClient != null) mXWalkContentsClient.onToggleFullscreen(enterFullscreen);
70 public boolean isFullscreen() {
71 if (mXWalkContentsClient != null) return mXWalkContentsClient.hasEnteredFullscreen();
77 public boolean shouldOverrideRunFileChooser(int processId, int renderId, int mode,
78 String acceptTypes, boolean capture) {
79 if (mXWalkContentsClient != null) {
80 return mXWalkContentsClient.shouldOverrideRunFileChooser(processId, renderId, mode,
81 acceptTypes, capture);