Index: ui/shell_dialogs/select_file_dialog_android.cc |
diff --git a/ui/shell_dialogs/select_file_dialog_android.cc b/ui/shell_dialogs/select_file_dialog_android.cc |
index b4dc7e8dc6945c931bc86367635b7e605349111e..e2c29d6887664d35b5be71f25a1d5cae5f334b7d 100644 |
--- a/ui/shell_dialogs/select_file_dialog_android.cc |
+++ b/ui/shell_dialogs/select_file_dialog_android.cc |
@@ -62,28 +62,22 @@ void SelectFileDialogImpl::SelectFileImpl( |
void* params) { |
JNIEnv* env = base::android::AttachCurrentThread(); |
- ScopedJavaLocalRef<jstring> capture_value; |
- std::vector<base::string16> accept_types; |
+ // The first element in the pair is a list of accepted types, the second |
+ // indicates whether the device's capture capabilities should be used. |
+ typedef std::pair<std::vector<base::string16>, bool> AcceptTypes; |
+ AcceptTypes accept_types = std::make_pair(std::vector<base::string16>(), |
+ false); |
+ |
if (params) { |
- accept_types = *(reinterpret_cast<std::vector<base::string16>*>(params)); |
- |
- // The last string in params is expected to be the string |
- // with capture value. |
- capture_value = base::android::ConvertUTF16ToJavaString(env, |
- StringToLowerASCII(accept_types.back())); |
- base::android::CheckException(env); |
- accept_types.pop_back(); |
- } else { |
- capture_value = base::android::ConvertUTF8ToJavaString(env, "filesystem"); |
+ accept_types = *(reinterpret_cast<AcceptTypes*>(params)); |
} |
- // The rest params elements are expected to be accept_types. |
ScopedJavaLocalRef<jobjectArray> accept_types_java = |
- base::android::ToJavaArrayOfStrings(env, accept_types); |
+ base::android::ToJavaArrayOfStrings(env, accept_types.first); |
Java_SelectFileDialog_selectFile(env, java_object_.obj(), |
accept_types_java.obj(), |
- capture_value.obj(), |
+ accept_types.second, |
owning_window->GetJavaObject().obj()); |
is_running_ = true; |
} |