Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ui/shell_dialogs/select_file_dialog_android.cc

Issue 157573002: Merge 248707 "Figure out the display name for a content uri." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/shell_dialogs/select_file_dialog_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "jni/SelectFileDialog_jni.h" 15 #include "jni/SelectFileDialog_jni.h"
16 #include "ui/base/android/window_android.h" 16 #include "ui/base/android/window_android.h"
17 #include "ui/shell_dialogs/selected_file_info.h"
17 18
18 namespace ui { 19 namespace ui {
19 20
20 // static 21 // static
21 SelectFileDialogImpl* SelectFileDialogImpl::Create(Listener* listener, 22 SelectFileDialogImpl* SelectFileDialogImpl::Create(Listener* listener,
22 SelectFilePolicy* policy) { 23 SelectFilePolicy* policy) {
23 return new SelectFileDialogImpl(listener, policy); 24 return new SelectFileDialogImpl(listener, policy);
24 } 25 }
25 26
26 void SelectFileDialogImpl::OnFileSelected(JNIEnv* env, 27 void SelectFileDialogImpl::OnFileSelected(JNIEnv* env,
27 jobject java_object, 28 jobject java_object,
28 jstring filepath) { 29 jstring filepath,
30 jstring display_name) {
29 if (listener_) { 31 if (listener_) {
30 std::string path = base::android::ConvertJavaStringToUTF8(env, filepath); 32 std::string path = base::android::ConvertJavaStringToUTF8(env, filepath);
31 listener_->FileSelected(base::FilePath(path), 0, NULL); 33 std::string file_name =
34 base::android::ConvertJavaStringToUTF8(env, display_name);
35 base::FilePath file_path = base::FilePath(path);
36 ui::SelectedFileInfo file_info;
37 file_info.file_path = file_path;
38 file_info.local_path = file_path;
39 if (!file_name.empty())
40 file_info.display_name = file_name;
41 listener_->FileSelectedWithExtraInfo(file_info, 0, NULL);
32 } 42 }
33 43
34 is_running_ = false; 44 is_running_ = false;
35 } 45 }
36 46
37 void SelectFileDialogImpl::OnFileNotSelected( 47 void SelectFileDialogImpl::OnFileNotSelected(
38 JNIEnv* env, 48 JNIEnv* env,
39 jobject java_object) { 49 jobject java_object) {
40 if (listener_) 50 if (listener_)
41 listener_->FileSelectionCanceled(NULL); 51 listener_->FileSelectionCanceled(NULL);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return false; 112 return false;
103 } 113 }
104 114
105 SelectFileDialog* CreateAndroidSelectFileDialog( 115 SelectFileDialog* CreateAndroidSelectFileDialog(
106 SelectFileDialog::Listener* listener, 116 SelectFileDialog::Listener* listener,
107 SelectFilePolicy* policy) { 117 SelectFilePolicy* policy) {
108 return SelectFileDialogImpl::Create(listener, policy); 118 return SelectFileDialogImpl::Create(listener, policy);
109 } 119 }
110 120
111 } // namespace ui 121 } // namespace ui
OLDNEW
« no previous file with comments | « ui/shell_dialogs/select_file_dialog_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698