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