| 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 30c557d719a0fff4ed308e45ad7b85093292aea9..59f072bca6f23182d4396f9bdf9ad07583f87b98 100644
|
| --- a/ui/shell_dialogs/select_file_dialog_android.cc
|
| +++ b/ui/shell_dialogs/select_file_dialog_android.cc
|
| @@ -106,22 +106,29 @@ void SelectFileDialogImpl::SelectFileImpl(
|
| void* params) {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
|
|
| - // 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));
|
| + 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, accept_types.back());
|
| + base::android::CheckException(env);
|
| + accept_types.pop_back();
|
| + } else {
|
| + capture_value = base::android::ConvertUTF8ToJavaString(env, "environment");
|
| + }
|
|
|
| ScopedJavaLocalRef<jobjectArray> accept_types_java =
|
| - base::android::ToJavaArrayOfStrings(env, accept_types.first);
|
| + base::android::ToJavaArrayOfStrings(env, accept_types);
|
|
|
| bool accept_multiple_files = SelectFileDialog::SELECT_OPEN_MULTI_FILE == type;
|
|
|
| Java_SelectFileDialog_selectFile(env, java_object_, accept_types_java,
|
| - accept_types.second, accept_multiple_files,
|
| + capture_value, accept_multiple_files,
|
| owning_window->GetJavaObject());
|
| }
|
|
|
|
|