summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/webkit/CallbackProxy.java27
-rw-r--r--core/java/android/webkit/WebChromeClient.java6
-rw-r--r--core/java/android/webkit/WebViewCore.java6
3 files changed, 32 insertions, 7 deletions
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 9521b490a501..fdcbe3d2516d 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -41,6 +41,7 @@ import com.android.internal.R;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
+import java.util.Map;
/**
* This class is a proxy class for handling WebCore -> UI thread messaging. All
@@ -725,7 +726,8 @@ class CallbackProxy extends Handler {
case OPEN_FILE_CHOOSER:
if (mWebChromeClient != null) {
- mWebChromeClient.openFileChooser((UploadFile) msg.obj);
+ UploadFileMessageData data = (UploadFileMessageData)msg.obj;
+ mWebChromeClient.openFileChooser(data.getUploadFile(), data.getAcceptType());
}
break;
@@ -1431,6 +1433,24 @@ class CallbackProxy extends Handler {
sendMessage(msg);
}
+ private static class UploadFileMessageData {
+ private UploadFile mCallback;
+ private String mAcceptType;
+
+ public UploadFileMessageData(UploadFile uploadFile, String acceptType) {
+ mCallback = uploadFile;
+ mAcceptType = acceptType;
+ }
+
+ public UploadFile getUploadFile() {
+ return mCallback;
+ }
+
+ public String getAcceptType() {
+ return mAcceptType;
+ }
+ }
+
private class UploadFile implements ValueCallback<Uri> {
private Uri mValue;
public void onReceiveValue(Uri value) {
@@ -1447,13 +1467,14 @@ class CallbackProxy extends Handler {
/**
* Called by WebViewCore to open a file chooser.
*/
- /* package */ Uri openFileChooser() {
+ /* package */ Uri openFileChooser(String acceptType) {
if (mWebChromeClient == null) {
return null;
}
Message myMessage = obtainMessage(OPEN_FILE_CHOOSER);
UploadFile uploadFile = new UploadFile();
- myMessage.obj = uploadFile;
+ UploadFileMessageData data = new UploadFileMessageData(uploadFile, acceptType);
+ myMessage.obj = data;
synchronized (this) {
sendMessage(myMessage);
try {
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 1d5aac7fb3c0..ad53508db21f 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -314,10 +314,12 @@ public class WebChromeClient {
/**
* Tell the client to open a file chooser.
* @param uploadFile A ValueCallback to set the URI of the file to upload.
- * onReceiveValue must be called to wake up the thread.
+ * onReceiveValue must be called to wake up the thread.a
+ * @param acceptType The value of the 'accept' attribute of the input tag
+ * associated with this file picker.
* @hide
*/
- public void openFileChooser(ValueCallback<Uri> uploadFile) {
+ public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType) {
uploadFile.onReceiveValue(null);
}
}
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index c1330223bded..974fcaaa83a7 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -276,10 +276,12 @@ final class WebViewCore {
/**
* Called by JNI. Open a file chooser to upload a file.
+ * @param acceptType The value of the 'accept' attribute of the
+ * input tag associated with this file picker.
* @return String version of the URI.
*/
- private String openFileChooser() {
- Uri uri = mCallbackProxy.openFileChooser();
+ private String openFileChooser(String acceptType) {
+ Uri uri = mCallbackProxy.openFileChooser(acceptType);
if (uri != null) {
String fileName = "";
Cursor cursor = mContext.getContentResolver().query(