Index: chrome/browser/download/download_prefs.cc |
diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc |
index cc1caaf4a4914504015c88dd5ff8c4326c936482..50bf9599d8b78f9a324a52b4e5afbdf040d11c6b 100644 |
--- a/chrome/browser/download/download_prefs.cc |
+++ b/chrome/browser/download/download_prefs.cc |
@@ -56,6 +56,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) { |
prompt_for_download_.Init(prefs::kPromptForDownload, prefs); |
download_path_.Init(prefs::kDownloadDefaultDirectory, prefs); |
+ save_file_path_.Init(prefs::kSaveFileDefaultDirectory, prefs); |
save_file_type_.Init(prefs::kSaveFileType, prefs); |
// We store any file extension that should be opened automatically at |
@@ -107,6 +108,10 @@ void DownloadPrefs::RegisterUserPrefs( |
prefs::kDownloadDefaultDirectory, |
default_download_path, |
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
+ registry->RegisterFilePathPref( |
+ prefs::kSaveFileDefaultDirectory, |
+ default_download_path, |
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
#if defined(OS_CHROMEOS) |
// Ensure that the download directory specified in the preferences exists. |
@@ -144,6 +149,23 @@ base::FilePath DownloadPrefs::DownloadPath() const { |
return *download_path_; |
} |
+void DownloadPrefs::SetDownloadPath(const base::FilePath& path) { |
+ download_path_.SetValue(path); |
+ SetSaveFilePath(path); |
+} |
+ |
+base::FilePath DownloadPrefs::SaveFilePath() const { |
+ return *save_file_path_; |
+} |
+ |
+void DownloadPrefs::SetSaveFilePath(const base::FilePath& path) { |
+ save_file_path_.SetValue(path); |
+} |
+ |
+void DownloadPrefs::SetSaveFileType(int type) { |
+ save_file_type_.SetValue(type); |
+} |
+ |
bool DownloadPrefs::PromptForDownload() const { |
// If the DownloadDirectory policy is set, then |prompt_for_download_| should |
// always be false. |