Skip to content

Commit f804ba1

Browse files
Ben MurdochAndroid (Google) Code Review
authored andcommitted
Merge "Add support for HTML Media Capture "capture" attribute."
2 parents c2401d0 + be71692 commit f804ba1

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

core/java/android/webkit/CallbackProxy.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,8 @@ public void onClick(
830830
case OPEN_FILE_CHOOSER:
831831
if (mWebChromeClient != null) {
832832
UploadFileMessageData data = (UploadFileMessageData)msg.obj;
833-
mWebChromeClient.openFileChooser(data.getUploadFile(), data.getAcceptType());
833+
mWebChromeClient.openFileChooser(data.getUploadFile(), data.getAcceptType(),
834+
data.getCapture());
834835
}
835836
break;
836837

@@ -1605,10 +1606,12 @@ public void getVisitedHistory(ValueCallback<String[]> callback) {
16051606
private static class UploadFileMessageData {
16061607
private UploadFile mCallback;
16071608
private String mAcceptType;
1609+
private String mCapture;
16081610

1609-
public UploadFileMessageData(UploadFile uploadFile, String acceptType) {
1611+
public UploadFileMessageData(UploadFile uploadFile, String acceptType, String capture) {
16101612
mCallback = uploadFile;
16111613
mAcceptType = acceptType;
1614+
mCapture = capture;
16121615
}
16131616

16141617
public UploadFile getUploadFile() {
@@ -1618,6 +1621,10 @@ public UploadFile getUploadFile() {
16181621
public String getAcceptType() {
16191622
return mAcceptType;
16201623
}
1624+
1625+
public String getCapture() {
1626+
return mCapture;
1627+
}
16211628
}
16221629

16231630
private class UploadFile implements ValueCallback<Uri> {
@@ -1636,13 +1643,13 @@ public Uri getResult() {
16361643
/**
16371644
* Called by WebViewCore to open a file chooser.
16381645
*/
1639-
/* package */ Uri openFileChooser(String acceptType) {
1646+
/* package */ Uri openFileChooser(String acceptType, String capture) {
16401647
if (mWebChromeClient == null) {
16411648
return null;
16421649
}
16431650
Message myMessage = obtainMessage(OPEN_FILE_CHOOSER);
16441651
UploadFile uploadFile = new UploadFile();
1645-
UploadFileMessageData data = new UploadFileMessageData(uploadFile, acceptType);
1652+
UploadFileMessageData data = new UploadFileMessageData(uploadFile, acceptType, capture);
16461653
myMessage.obj = data;
16471654
synchronized (this) {
16481655
sendMessage(myMessage);

core/java/android/webkit/WebChromeClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,11 @@ public void getVisitedHistory(ValueCallback<String[]> callback) {
346346
* onReceiveValue must be called to wake up the thread.a
347347
* @param acceptType The value of the 'accept' attribute of the input tag
348348
* associated with this file picker.
349+
* @param capture The value of the 'capture' attribute of the input tag
350+
* associated with this file picker.
349351
* @hide
350352
*/
351-
public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType) {
353+
public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType, String capture) {
352354
uploadFile.onReceiveValue(null);
353355
}
354356

core/java/android/webkit/WebViewCore.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,12 @@ enum FocusDirection {
394394
* Called by JNI. Open a file chooser to upload a file.
395395
* @param acceptType The value of the 'accept' attribute of the
396396
* input tag associated with this file picker.
397+
* @param capture The value of the 'capture' attribute of the
398+
* input tag associated with this file picker.
397399
* @return String version of the URI.
398400
*/
399-
private String openFileChooser(String acceptType) {
400-
Uri uri = mCallbackProxy.openFileChooser(acceptType);
401+
private String openFileChooser(String acceptType, String capture) {
402+
Uri uri = mCallbackProxy.openFileChooser(acceptType, capture);
401403
if (uri != null) {
402404
String filePath = "";
403405
// Note - querying for MediaStore.Images.Media.DATA

0 commit comments

Comments
 (0)