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

Unified Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 2450004: Don't save last used locations in open and save dialogs when in incognito mode. (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: Rename kLastSelectedDirectory to kSelectFileLastDirectory. Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698