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); |
} |