summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile.cc
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 08:42:51 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-09 08:42:51 +0000
commit35896a39fe47d8b17969a07c629c69e6a17ceb30 (patch)
tree588f2208a07630501597e3ba3ecfc6034954c7c0 /chrome/browser/profile.cc
parent7ac1ce2f4d2e385c53340f501764bdd59bd86ad4 (diff)
downloadchromium_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/profile.cc')
-rw-r--r--chrome/browser/profile.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index c0be2f9..b2bdf7f 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -215,6 +215,7 @@ void Profile::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints);
prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties);
prefs->RegisterBooleanPref(prefs::kDisableExtensions, false);
+ prefs->RegisterStringPref(prefs::kSelectFileLastDirectory, L"");
}
// static
@@ -583,6 +584,18 @@ class OffTheRecordProfileImpl : public Profile,
return profile_->GetNTPResourceCache();
}
+ virtual FilePath last_selected_directory() {
+ const FilePath& directory = last_selected_directory_;
+ if (directory.empty()) {
+ return profile_->last_selected_directory();
+ }
+ return directory;
+ }
+
+ virtual void set_last_selected_directory(const FilePath& path) {
+ last_selected_directory_ = path;
+ }
+
virtual void ExitedOffTheRecordMode() {
// Drop our download manager so we forget about all the downloads made
// in off-the-record mode.
@@ -648,6 +661,8 @@ class OffTheRecordProfileImpl : public Profile,
// Should be used only on the file thread.
scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
+ FilePath last_selected_directory_;
+
DISALLOW_COPY_AND_ASSIGN(OffTheRecordProfileImpl);
};
@@ -824,6 +839,14 @@ NTPResourceCache* ProfileImpl::GetNTPResourceCache() {
return ntp_resource_cache_.get();
}
+FilePath ProfileImpl::last_selected_directory() {
+ return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
+}
+
+void ProfileImpl::set_last_selected_directory(const FilePath& path) {
+ GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path);
+}
+
ProfileImpl::~ProfileImpl() {
NotificationService::current()->Notify(
NotificationType::PROFILE_DESTROYED,