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

Unified Diff: chrome/browser/profile.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.h ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profile.cc
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 2f46701a8e73362c44e39cd195e306c6d434dc09..5b7a88f0f5780b0578e166a3e0f8b71cace04275 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -214,6 +214,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
@@ -582,6 +583,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.
@@ -647,6 +660,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);
};
@@ -823,6 +838,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,
« no previous file with comments | « chrome/browser/profile.h ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698