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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 12662032: Merge SavePackageFilePicker{,ChromeOS} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r196175 Created 7 years, 8 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
Index: chrome/browser/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 93bd6656729d4f8e54af2348c4f0e77bf97119e8..0d5e86270bbe313cd78f20bcf61357911429969e 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -61,7 +61,6 @@
#include "chrome/browser/download/save_package_file_picker_chromeos.h"
#endif
-using content::BrowserContext;
using content::BrowserThread;
using content::DownloadId;
using content::DownloadItem;
@@ -181,6 +180,24 @@ base::FilePath GetPlatformDownloadPath(Profile* profile,
return download->GetFullPath();
}
+void VirtualSavePathChosen(content::BrowserContext* context,
+ const base::FilePath& path) {
+ StringPrefMember save_file_path;
+ save_file_path.Init(prefs::kSaveFileDefaultDirectory,
+ Profile::FromBrowserContext(context)->GetPrefs());
+#if defined(OS_POSIX)
+ std::string path_string = path.DirName().value();
+#elif defined(OS_WIN)
+ std::string path_string = WideToUTF8(path.DirName().value());
Randy Smith (Not in Mondays) 2013/04/25 17:58:55 Is this the usual method of persisting file paths
asanka 2013/04/25 19:01:39 kSaveFileDefaultDirectory is registered in CDMD as
benjhayden 2013/04/30 21:11:12 Done.
benjhayden 2013/04/30 21:11:12 Done.
+#endif
+ // If user change the default saving directory, we will remember it just
+ // like IE and FireFox.
+ if (!context->IsOffTheRecord() &&
+ (save_file_path.GetValue() != path_string)) {
+ save_file_path.SetValue(path_string);
+ }
+}
+
} // namespace
// static
@@ -214,8 +231,8 @@ DownloadId ChromeDownloadManagerDelegate::GetNextId() {
if (!profile_->IsOffTheRecord())
return DownloadId(this, next_download_id_++);
- return BrowserContext::GetDownloadManager(profile_->GetOriginalProfile())->
- GetDelegate()->GetNextId();
+ return content::BrowserContext::GetDownloadManager(
+ profile_->GetOriginalProfile())->GetDelegate()->GetNextId();
}
bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
@@ -368,7 +385,7 @@ bool ChromeDownloadManagerDelegate::GenerateFileHash() {
}
void ChromeDownloadManagerDelegate::GetSaveDir(
- BrowserContext* browser_context,
+ content::BrowserContext* browser_context,
base::FilePath* website_save_dir,
base::FilePath* download_save_dir,
bool* skip_dir_check) {
@@ -412,6 +429,7 @@ void ChromeDownloadManagerDelegate::ChooseSavePath(
web_contents,
suggested_path,
can_save_as_complete,
+ base::Bind(&VirtualSavePathChosen, web_contents->GetBrowserContext()),
callback);
#else
new SavePackageFilePicker(
@@ -420,6 +438,7 @@ void ChromeDownloadManagerDelegate::ChooseSavePath(
default_extension,
can_save_as_complete,
download_prefs_.get(),
+ base::Bind(&VirtualSavePathChosen, web_contents->GetBrowserContext()),
callback);
#endif
}
« no previous file with comments | « no previous file | chrome/browser/download/save_package_file_picker.h » ('j') | chrome/browser/download/save_package_file_picker.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698