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, |