Chromium Code Reviews| 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..00c95437ce730719065654bec0303e877564b0fd 100644 |
| --- a/ui/shell_dialogs/select_file_dialog_android.cc |
| +++ b/ui/shell_dialogs/select_file_dialog_android.cc |
| @@ -62,28 +62,20 @@ void SelectFileDialogImpl::SelectFileImpl( |
| void* params) { |
| JNIEnv* env = base::android::AttachCurrentThread(); |
| - ScopedJavaLocalRef<jstring> capture_value; |
| - std::vector<base::string16> accept_types; |
| - 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"); |
| - } |
| + // 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<AcceptTypes*>(params)); |
|
joth
2013/07/04 18:09:07
this should be on two lines. or use 3 if you use
|
| - // 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); |
| + bool has_capture_attribute = accept_types.second; |
| Java_SelectFileDialog_selectFile(env, java_object_.obj(), |
| accept_types_java.obj(), |
| - capture_value.obj(), |
| + has_capture_attribute, |
| owning_window->GetJavaObject().obj()); |
| is_running_ = true; |
| } |