summaryrefslogtreecommitdiffstats
path: root/chrome/browser/file_select_helper.cc
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-26 02:31:09 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-26 02:31:09 +0000
commit53f04c88f0a08ec58dcbb1fcf97abceb75bb4183 (patch)
tree6699e468b259327bc27f736a05f78353838ad914 /chrome/browser/file_select_helper.cc
parent2fe6ded039f48204a4414b2b938b38a01fc9cf58 (diff)
downloadchromium_src-53f04c88f0a08ec58dcbb1fcf97abceb75bb4183.zip
chromium_src-53f04c88f0a08ec58dcbb1fcf97abceb75bb4183.tar.gz
chromium_src-53f04c88f0a08ec58dcbb1fcf97abceb75bb4183.tar.bz2
Fix open dialog not remembering last opened folder on drive
The problem is dialog passes file's local cache path in FileSelected. Last selected directory paths get set to cache dir, which file manager does not understand, so it opens default dir. In order to properly remember last selected dir, we should also pass file's drive path to dialog listeners and use it to remember last selected dir. BUG=126923 TEST=manual Review URL: https://chromiumcodereview.appspot.com/10804026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/file_select_helper.cc')
-rw-r--r--chrome/browser/file_select_helper.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
index 67c886d..0c9669c 100644
--- a/chrome/browser/file_select_helper.cc
+++ b/chrome/browser/file_select_helper.cc
@@ -67,14 +67,13 @@ void NotifyRenderViewHost(RenderViewHost* render_view_host,
render_view_host->FilesSelectedInChooser(files, permissions);
}
-// Converts a list of FilePaths to a list of SelectedFileInfo, with the
-// display name field left empty.
-std::vector<ui::SelectedFileInfo> ConvertToSelectedFileInfoList(
+// Converts a list of FilePaths to a list of ui::SelectedFileInfo.
+std::vector<ui::SelectedFileInfo> FilePathListToSelectedFileInfoList(
const std::vector<FilePath>& paths) {
std::vector<ui::SelectedFileInfo> selected_files;
for (size_t i = 0; i < paths.size(); ++i) {
selected_files.push_back(
- ui::SelectedFileInfo(paths[i], FilePath::StringType()));
+ ui::SelectedFileInfo(paths[i], paths[i]));
}
return selected_files;
}
@@ -118,9 +117,7 @@ FileSelectHelper::~FileSelectHelper() {
void FileSelectHelper::FileSelected(const FilePath& path,
int index, void* params) {
- FileSelectedWithExtraInfo(
- ui::SelectedFileInfo(path, FilePath::StringType()),
- index, params);
+ FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params);
}
void FileSelectHelper::FileSelectedWithExtraInfo(
@@ -130,9 +127,9 @@ void FileSelectHelper::FileSelectedWithExtraInfo(
if (!render_view_host_)
return;
- const FilePath& path = file.path;
- profile_->set_last_selected_directory(path.DirName());
+ profile_->set_last_selected_directory(file.file_path.DirName());
+ const FilePath& path = file.local_path;
if (dialog_type_ == SelectFileDialog::SELECT_FOLDER) {
StartNewEnumeration(path, kFileSelectEnumerationId, render_view_host_);
return;
@@ -149,7 +146,8 @@ void FileSelectHelper::FileSelectedWithExtraInfo(
void FileSelectHelper::MultiFilesSelected(const std::vector<FilePath>& files,
void* params) {
std::vector<ui::SelectedFileInfo> selected_files =
- ConvertToSelectedFileInfoList(files);
+ FilePathListToSelectedFileInfoList(files);
+
MultiFilesSelectedWithExtraInfo(selected_files, params);
}
@@ -157,7 +155,7 @@ void FileSelectHelper::MultiFilesSelectedWithExtraInfo(
const std::vector<ui::SelectedFileInfo>& files,
void* params) {
if (!files.empty())
- profile_->set_last_selected_directory(files[0].path.DirName());
+ profile_->set_last_selected_directory(files[0].file_path.DirName());
if (!render_view_host_)
return;
@@ -228,7 +226,7 @@ void FileSelectHelper::OnListDone(int id, int error) {
}
std::vector<ui::SelectedFileInfo> selected_files =
- ConvertToSelectedFileInfoList(entry->results_);
+ FilePathListToSelectedFileInfoList(entry->results_);
if (id == kFileSelectEnumerationId)
NotifyRenderViewHost(entry->rvh_, selected_files, dialog_type_);