| 1 | // Copyright (c) 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 |
| 24 | public abstract void runFileChooser(int processId, int renderId, int mode_flags, |
| 25 | String acceptTypes, String title, String defaultFilename, boolean capture); |
| 26 | |
| 27 | @CalledByNative |
| 28 | public abstract boolean addNewContents(boolean isDialog, boolean isUserGesture); |
| 29 | |
| 30 | @CalledByNative |
| 31 | public abstract void closeContents(); |
| 32 | |
| 33 | @CalledByNative |
| 34 | public abstract void activateContents(); |
| 35 | |
| 36 | /** |
| 37 | * Report a change in the preferred size. |
| 38 | * @param width preferred width in CSS pixels. |
| 39 | * @param height scroll height of the document element in CSS pixels. |
| 40 | */ |
| 41 | @CalledByNative |
| 42 | public void updatePreferredSize(int widthCss, int heightCss) { |
| 43 | } |
| 44 | |
| 45 | // Call in response to a prior runFileChooser call. |
| 46 | protected static native void nativeFilesSelectedInChooser(int processId, int renderId, |
| 47 | int mode_flags, String[] filePath); |
| 48 | } |