Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2002)

Unified Diff: ui/android/java/src/org/chromium/ui/SelectFileDialog.java

Issue 14758008: Update the HTML Media Capture implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove local variable Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | ui/shell_dialogs/select_file_dialog_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/SelectFileDialog.java
diff --git a/ui/android/java/src/org/chromium/ui/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/SelectFileDialog.java
index a9b117bb641a1b1f4b13ce8284fb71fb43f4fc1f..7259059f3b948b14ee28072f934cf459196c4565 100644
--- a/ui/android/java/src/org/chromium/ui/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/SelectFileDialog.java
@@ -34,15 +34,11 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
private static final String ALL_VIDEO_TYPES = VIDEO_TYPE + "*";
private static final String ALL_AUDIO_TYPES = AUDIO_TYPE + "*";
private static final String ANY_TYPES = "*/*";
- private static final String CAPTURE_CAMERA = "camera";
- private static final String CAPTURE_CAMCORDER = "camcorder";
- private static final String CAPTURE_MICROPHONE = "microphone";
- private static final String CAPTURE_FILESYSTEM = "filesystem";
private static final String CAPTURE_IMAGE_DIRECTORY = "browser-photos";
private final int mNativeSelectFileDialog;
private List<String> mFileTypes;
- private String mCapture; // May be null if no capture parameter was set.
+ private boolean mCapture;
private Uri mCameraOutputUri;
private SelectFileDialog(int nativeSelectFileDialog) {
@@ -56,7 +52,7 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
* @param window The WindowAndroid that can show intents
*/
@CalledByNative
- private void selectFile(String[] fileTypes, String capture, WindowAndroid window) {
+ private void selectFile(String[] fileTypes, boolean capture, WindowAndroid window) {
mFileTypes = new ArrayList<String>(Arrays.asList(fileTypes));
mCapture = capture;
@@ -69,9 +65,9 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
MediaStore.Audio.Media.RECORD_SOUND_ACTION);
String lowMemoryError = window.getContext().getString(R.string.low_memory_error);
- // Quick check - if a capture parameter other than filesystem (the default) is specified we
- // should just launch the appropriate intent. Otherwise build up a chooser based on the
- // accept type and then display that to the user.
+ // Quick check - if the |capture| parameter is set and |fileTypes| has the appropriate MIME
+ // type, we should just launch the appropriate intent. Otherwise build up a chooser based on
+ // the accept type and then display that to the user.
if (captureCamera()) {
if (window.showIntent(camera, this, lowMemoryError)) return;
} else if (captureCamcorder()) {
@@ -215,22 +211,20 @@ class SelectFileDialog implements WindowAndroid.IntentCallback{
return shouldShowTypes(ALL_AUDIO_TYPES, AUDIO_TYPE);
}
+ private boolean acceptsSpecificType(String type) {
+ return mFileTypes.size() == 1 && mFileTypes.at(0).equals(type);
Ted C 2013/07/08 21:50:56 I don't think "at(...)" exists for ArrayList...tha
+ }
+
private boolean captureCamera() {
- return shouldShowImageTypes() && mCapture != null && mCapture.startsWith(CAPTURE_CAMERA);
+ return mCapture && acceptsSpecificType(ALL_IMAGE_TYPES);
}
private boolean captureCamcorder() {
- return shouldShowVideoTypes() && mCapture != null &&
- mCapture.startsWith(CAPTURE_CAMCORDER);
+ return mCapture && acceptsSpecificType(ALL_VIDEO_TYPES);
}
private boolean captureMicrophone() {
- return shouldShowAudioTypes() && mCapture != null &&
- mCapture.startsWith(CAPTURE_MICROPHONE);
- }
-
- private boolean captureFilesystem() {
- return mCapture != null && mCapture.startsWith(CAPTURE_FILESYSTEM);
+ return mCapture && acceptsSpecificType(ALL_AUDIO_TYPES);
}
private boolean acceptSpecificType(String accept) {
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | ui/shell_dialogs/select_file_dialog_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698