1 // Copyright 2012 The Chromium Authors. 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.chromium.android_webview; 6 7 import org.chromium.base.CalledByNative; 8 import org.chromium.base.JNINamespace; 9 import org.chromium.base.VisibleForTesting; 10 import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid; 11 12 /** 13 * WebView-specific WebContentsDelegate. 14 * This file is the Java version of the native class of the same name. 15 * It should contain abstract WebContentsDelegate methods to be implemented by the embedder. 16 * These methods belong to WebView but are not shared with the Chromium Android port. 17 */ 18 @VisibleForTesting 19 @JNINamespace("android_webview") 20 public abstract class AwWebContentsDelegate extends WebContentsDelegateAndroid { 21 // Callback filesSelectedInChooser() when done. 22 @CalledByNative runFileChooser(int processId, int renderId, int modeFlags, String acceptTypes, String title, String defaultFilename, boolean capture)23 public abstract void runFileChooser(int processId, int renderId, int modeFlags, 24 String acceptTypes, String title, String defaultFilename, boolean capture); 25 26 @CalledByNative addNewContents(boolean isDialog, boolean isUserGesture)27 public abstract boolean addNewContents(boolean isDialog, boolean isUserGesture); 28 29 @Override 30 @CalledByNative closeContents()31 public abstract void closeContents(); 32 33 @Override 34 @CalledByNative activateContents()35 public abstract void activateContents(); 36 37 @Override 38 @CalledByNative toggleFullscreenModeForTab(boolean enterFullscreen)39 public abstract void toggleFullscreenModeForTab(boolean enterFullscreen); 40 41 // Call in response to a prior runFileChooser call. nativeFilesSelectedInChooser(int processId, int renderId, int modeFlags, String[] filePath, String[] displayName)42 protected static native void nativeFilesSelectedInChooser(int processId, int renderId, 43 int modeFlags, String[] filePath, String[] displayName); 44 } 45