Add support for HTML Media Capture "capture" attribute.

Plumb the value of the "capture" attribute through the framework
down to the embedder.

Requires a change in WebKit
(I0a921be31fda79a43c05da4fe22d9c808d92709c)

and Browser (I38dfe2df043fdba1388384dbd3b5370737eb38e5).

Bug: 5771207

Change-Id: I494adc1274ca21ce8fe52a6c7b6b758217927e66
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index 800ebc8..bcd6c3b 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -791,7 +791,8 @@
             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;
 
@@ -1566,10 +1567,12 @@
     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() {
@@ -1579,6 +1582,10 @@
         public String getAcceptType() {
             return mAcceptType;
         }
+
+        public String getCapture() {
+            return mCapture;
+        }
     }
 
     private class UploadFile implements ValueCallback<Uri> {
@@ -1597,13 +1604,13 @@
     /**
      * 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);
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index a6ef0ce..5cb0d41 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -346,9 +346,11 @@
      *      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);
     }
 
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 15a2d48..c83d106 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -394,10 +394,12 @@
      * 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