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..6ed9be3b539b5fe1b93b16cce23fee702a739cad 100644 |
| --- a/ui/shell_dialogs/select_file_dialog_android.cc |
| +++ b/ui/shell_dialogs/select_file_dialog_android.cc |
| @@ -62,28 +62,23 @@ 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)); |
|
sky
2013/07/08 21:13:51
spacing is off here.
Raphael Kubo da Costa (rakuco)
2013/07/08 21:27:01
Done.
|
| } |
| - // 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; |
|
sky
2013/07/08 21:13:51
Is there a reason for the local rather then accepo
Raphael Kubo da Costa (rakuco)
2013/07/08 21:27:01
It seemed to be easier to understand that way. Wou
sky
2013/07/08 21:32:32
I like consistency. Since you don't declare a loca
Raphael Kubo da Costa (rakuco)
2013/07/08 21:38:12
Done.
|
| Java_SelectFileDialog_selectFile(env, java_object_.obj(), |
| accept_types_java.obj(), |
| - capture_value.obj(), |
| + has_capture_attribute, |
| owning_window->GetJavaObject().obj()); |
| is_running_ = true; |
| } |