Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2464)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java

Issue 20666003: [Android] Expose showFileChooser in AwContentsClient interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix findbugs Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
index f5eefe871c9780ae227e1d3ed7aea083d793f03f..260ea96243b4ec5af404d372f528baeff70f06da 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
@@ -11,6 +11,7 @@ import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.ConsoleMessage;
+import android.webkit.ValueCallback;
import org.chromium.content.browser.ContentViewCore;
@@ -86,14 +87,15 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
@Override
public void openNewTab(String url, String extraHeaders, byte[] postData, int disposition) {
- // TODO: implement
+ // This is only called in chrome layers.
+ assert false;
}
@Override
public boolean addNewContents(int nativeSourceWebContents, int nativeWebContents,
int disposition, Rect initialPosition, boolean userGesture) {
- // TODO: implement
- return false;
+ // This is overridden native side; see the other addNewContents overload.
+ throw new RuntimeException("Impossible");
}
@Override
@@ -136,6 +138,29 @@ class AwWebContentsDelegateAdapter extends AwWebContentsDelegate {
}
@Override
+ public void runFileChooser(final int processId, final int renderId, final int mode_flags,
+ String acceptTypes, String title, String defaultFilename, boolean capture) {
+ AwContentsClient.FileChooserParams params = new AwContentsClient.FileChooserParams();
+ params.mode = mode_flags;
+ params.acceptTypes = acceptTypes;
+ params.title = title;
+ params.defaultFilename = defaultFilename;
+ params.capture = capture;
+
+ mContentsClient.showFileChooser(new ValueCallback<String[]>() {
+ boolean completed = false;
+ @Override
+ public void onReceiveValue(String[] results) {
+ if (completed) {
+ throw new IllegalStateException("Duplicate showFileChooser result");
+ }
+ completed = true;
+ nativeFilesSelectedInChooser(processId, renderId, mode_flags, results);
+ }
+ }, params);
+ }
+
+ @Override
public boolean addNewContents(boolean isDialog, boolean isUserGesture) {
return mContentsClient.onCreateWindow(isDialog, isUserGesture);
}
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java ('k') | android_webview/native/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698