Index: chrome/browser/tab_contents/tab_contents.cc |
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc |
index 8e2fff53d930b006ff38243e16e0ce52f2c88354..eed7922d2e1015102af467174a01130e253d437d 100644 |
--- a/chrome/browser/tab_contents/tab_contents.cc |
+++ b/chrome/browser/tab_contents/tab_contents.cc |
@@ -2577,8 +2577,11 @@ void TabContents::RunFileChooser( |
dialog_type = SelectFileDialog::SELECT_OPEN_FILE; // Prevent warning. |
NOTREACHED(); |
} |
+ FilePath default_file_name = params.default_file_name; |
+ if (default_file_name.empty()) |
+ default_file_name = profile()->last_selected_directory(); |
select_file_dialog_->SelectFile(dialog_type, params.title, |
- params.default_file_name, |
+ default_file_name, |
NULL, 0, FILE_PATH_LITERAL(""), |
view_->GetTopLevelNativeWindow(), NULL); |
} |
@@ -2839,6 +2842,7 @@ void TabContents::FocusedNodeChanged() { |
void TabContents::FileSelected(const FilePath& path, |
int index, void* params) { |
+ profile()->set_last_selected_directory(path.DirName()); |
std::vector<FilePath> files; |
files.push_back(path); |
render_view_host()->FilesSelectedInChooser(files); |
@@ -2846,6 +2850,8 @@ void TabContents::FileSelected(const FilePath& path, |
void TabContents::MultiFilesSelected(const std::vector<FilePath>& files, |
void* params) { |
+ if (!files.empty()) |
+ profile()->set_last_selected_directory(files[0].DirName()); |
render_view_host()->FilesSelectedInChooser(files); |
} |