Index: ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java |
diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java |
index 6df889967a11f94e1086f602b429d009616351fc..7dc5c0cef36a58adb36ac69f80ac5dede04cb821 100644 |
--- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java |
+++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java |
@@ -88,7 +88,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, |
private final long mNativeSelectFileDialog; |
private List<String> mFileTypes; |
- private boolean mCapture; |
+ private String mCapture; |
private boolean mAllowMultiple; |
private Uri mCameraOutputUri; |
private WindowAndroid mWindowAndroid; |
@@ -127,7 +127,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) |
@CalledByNative |
private void selectFile( |
- String[] fileTypes, boolean capture, boolean multiple, WindowAndroid window) { |
+ String[] fileTypes, String capture, boolean multiple, WindowAndroid window) { |
mFileTypes = new ArrayList<String>(Arrays.asList(fileTypes)); |
mCapture = capture; |
mAllowMultiple = multiple; |
@@ -316,6 +316,11 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, |
camera.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION |
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION); |
camera.putExtra(MediaStore.EXTRA_OUTPUT, mCameraOutputUri); |
+ |
+ // TODO(riju): Add functionality when Android officially |
+ // supports intent extra for the camera facing. |
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=698853#c11 |
+ |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { |
camera.setClipData(ClipData.newUri( |
mWindowAndroid.getApplicationContext().getContentResolver(), |
@@ -419,7 +424,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, |
@Override |
public void onRequestPermissionsResult(String[] permissions, int[] grantResults) { |
for (int i = 0; i < grantResults.length; i++) { |
- if (grantResults[i] == PackageManager.PERMISSION_DENIED && mCapture) { |
+ if (grantResults[i] == PackageManager.PERMISSION_DENIED && mCapture != null) { |
onFileNotSelected(); |
return; |
} |
@@ -504,15 +509,15 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, |
} |
private boolean captureCamera() { |
- return mCapture && acceptsSpecificType(ALL_IMAGE_TYPES); |
+ return mCapture != null && acceptsSpecificType(ALL_IMAGE_TYPES); |
} |
private boolean captureCamcorder() { |
- return mCapture && acceptsSpecificType(ALL_VIDEO_TYPES); |
+ return mCapture != null && acceptsSpecificType(ALL_VIDEO_TYPES); |
} |
private boolean captureMicrophone() { |
- return mCapture && acceptsSpecificType(ALL_AUDIO_TYPES); |
+ return mCapture != null && acceptsSpecificType(ALL_AUDIO_TYPES); |
} |
private int countAcceptTypesFor(String accept) { |