diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 08:42:51 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 08:42:51 +0000 |
commit | 35896a39fe47d8b17969a07c629c69e6a17ceb30 (patch) | |
tree | 588f2208a07630501597e3ba3ecfc6034954c7c0 /chrome/browser/tab_contents | |
parent | 7ac1ce2f4d2e385c53340f501764bdd59bd86ad4 (diff) | |
download | chromium_src-35896a39fe47d8b17969a07c629c69e6a17ceb30.zip chromium_src-35896a39fe47d8b17969a07c629c69e6a17ceb30.tar.gz chromium_src-35896a39fe47d8b17969a07c629c69e6a17ceb30.tar.bz2 |
Don't save last used locations in open and save dialogs when in incognito mode.
For "Save page as..." we simply don't store the save location in incognito mode.
For "Open File"... and file upload controls, it's a bit more complicated: because NSOpenPanel and NSSavePanel default to using the last chosen directory from NavigationServices (which we can't influence),
we provide a preference value prefs::kLastChosenDirectory as fallback there, which is not persisted in incognito mode.
BUG=45064
TEST=See bug for manual test.
Review URL: http://codereview.chromium.org/2450004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 6cbf922..15206a5 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -2589,8 +2589,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); } @@ -2851,6 +2854,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); @@ -2858,6 +2862,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); } |