Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f804ba13 authored by Ben Murdoch's avatar Ben Murdoch Committed by Android (Google) Code Review
Browse files

Merge "Add support for HTML Media Capture "capture" attribute."

parents c2401d09 be716920
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -830,7 +830,8 @@ class CallbackProxy extends Handler {
            case OPEN_FILE_CHOOSER:
                if (mWebChromeClient != null) {
                    UploadFileMessageData data = (UploadFileMessageData)msg.obj;
                    mWebChromeClient.openFileChooser(data.getUploadFile(), data.getAcceptType());
                    mWebChromeClient.openFileChooser(data.getUploadFile(), data.getAcceptType(),
                            data.getCapture());
                }
                break;

@@ -1605,10 +1606,12 @@ class CallbackProxy extends Handler {
    private static class UploadFileMessageData {
        private UploadFile mCallback;
        private String mAcceptType;
        private String mCapture;

        public UploadFileMessageData(UploadFile uploadFile, String acceptType) {
        public UploadFileMessageData(UploadFile uploadFile, String acceptType, String capture) {
            mCallback = uploadFile;
            mAcceptType = acceptType;
            mCapture = capture;
        }

        public UploadFile getUploadFile() {
@@ -1618,6 +1621,10 @@ class CallbackProxy extends Handler {
        public String getAcceptType() {
            return mAcceptType;
        }

        public String getCapture() {
            return mCapture;
        }
    }

    private class UploadFile implements ValueCallback<Uri> {
@@ -1636,13 +1643,13 @@ class CallbackProxy extends Handler {
    /**
     * Called by WebViewCore to open a file chooser.
     */
    /* package */ Uri openFileChooser(String acceptType) {
    /* package */ Uri openFileChooser(String acceptType, String capture) {
        if (mWebChromeClient == null) {
            return null;
        }
        Message myMessage = obtainMessage(OPEN_FILE_CHOOSER);
        UploadFile uploadFile = new UploadFile();
        UploadFileMessageData data = new UploadFileMessageData(uploadFile, acceptType);
        UploadFileMessageData data = new UploadFileMessageData(uploadFile, acceptType, capture);
        myMessage.obj = data;
        synchronized (this) {
            sendMessage(myMessage);
+3 −1
Original line number Diff line number Diff line
@@ -346,9 +346,11 @@ public class WebChromeClient {
     *      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.
     * @param capture The value of the 'capture' attribute of the input tag
     *         associated with this file picker.
     * @hide
     */
    public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType) {
    public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType, String capture) {
        uploadFile.onReceiveValue(null);
    }

+4 −2
Original line number Diff line number Diff line
@@ -394,10 +394,12 @@ public 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.
     * @param capture The value of the 'capture' attribute of the
     *         input tag associated with this file picker.
     * @return String version of the URI.
     */
    private String openFileChooser(String acceptType) {
        Uri uri = mCallbackProxy.openFileChooser(acceptType);
    private String openFileChooser(String acceptType, String capture) {
        Uri uri = mCallbackProxy.openFileChooser(acceptType, capture);
        if (uri != null) {
            String filePath = "";
            // Note - querying for MediaStore.Images.Media.DATA