| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "select_file_dialog_android.h" | 5 #include "select_file_dialog_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 false); | 113 false); |
| 114 | 114 |
| 115 if (params) | 115 if (params) |
| 116 accept_types = *(reinterpret_cast<AcceptTypes*>(params)); | 116 accept_types = *(reinterpret_cast<AcceptTypes*>(params)); |
| 117 | 117 |
| 118 ScopedJavaLocalRef<jobjectArray> accept_types_java = | 118 ScopedJavaLocalRef<jobjectArray> accept_types_java = |
| 119 base::android::ToJavaArrayOfStrings(env, accept_types.first); | 119 base::android::ToJavaArrayOfStrings(env, accept_types.first); |
| 120 | 120 |
| 121 bool accept_multiple_files = SelectFileDialog::SELECT_OPEN_MULTI_FILE == type; | 121 bool accept_multiple_files = SelectFileDialog::SELECT_OPEN_MULTI_FILE == type; |
| 122 | 122 |
| 123 Java_SelectFileDialog_selectFile(env, java_object_.obj(), | 123 Java_SelectFileDialog_selectFile(env, java_object_, accept_types_java, |
| 124 accept_types_java.obj(), | 124 accept_types.second, accept_multiple_files, |
| 125 accept_types.second, | 125 owning_window->GetJavaObject()); |
| 126 accept_multiple_files, | |
| 127 owning_window->GetJavaObject().obj()); | |
| 128 } | 126 } |
| 129 | 127 |
| 130 bool SelectFileDialogImpl::RegisterSelectFileDialog(JNIEnv* env) { | 128 bool SelectFileDialogImpl::RegisterSelectFileDialog(JNIEnv* env) { |
| 131 return RegisterNativesImpl(env); | 129 return RegisterNativesImpl(env); |
| 132 } | 130 } |
| 133 | 131 |
| 134 SelectFileDialogImpl::~SelectFileDialogImpl() { | 132 SelectFileDialogImpl::~SelectFileDialogImpl() { |
| 135 } | 133 } |
| 136 | 134 |
| 137 SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener, | 135 SelectFileDialogImpl::SelectFileDialogImpl(Listener* listener, |
| 138 SelectFilePolicy* policy) | 136 SelectFilePolicy* policy) |
| 139 : SelectFileDialog(listener, policy) { | 137 : SelectFileDialog(listener, policy) { |
| 140 JNIEnv* env = base::android::AttachCurrentThread(); | 138 JNIEnv* env = base::android::AttachCurrentThread(); |
| 141 java_object_.Reset( | 139 java_object_.Reset( |
| 142 Java_SelectFileDialog_create(env, reinterpret_cast<intptr_t>(this))); | 140 Java_SelectFileDialog_create(env, reinterpret_cast<intptr_t>(this))); |
| 143 } | 141 } |
| 144 | 142 |
| 145 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { | 143 bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() { |
| 146 NOTIMPLEMENTED(); | 144 NOTIMPLEMENTED(); |
| 147 return false; | 145 return false; |
| 148 } | 146 } |
| 149 | 147 |
| 150 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, | 148 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, |
| 151 SelectFilePolicy* policy) { | 149 SelectFilePolicy* policy) { |
| 152 return SelectFileDialogImpl::Create(listener, policy); | 150 return SelectFileDialogImpl::Create(listener, policy); |
| 153 } | 151 } |
| 154 | 152 |
| 155 } // namespace ui | 153 } // namespace ui |
| OLD | NEW |