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

Unified Diff: content/browser/download/download_manager_impl.cc

Issue 2948443002: [Merge to M60] Change linux default hidden file save directory to XDG_DATA_HOME (Closed)
Patch Set: Created 3 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 | « no previous file | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_manager_impl.cc
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index ecd6d88ca03e663cce57053be28a5cb822deef2f..02c7f12da9fe2f5b8473c908b1057d3b478d8515 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -55,6 +55,10 @@
#include "storage/browser/blob/blob_url_request_job_factory.h"
#include "url/origin.h"
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#include "base/nix/xdg_util.h"
+#endif
+
namespace content {
namespace {
@@ -174,6 +178,13 @@ class DownloadItemFactoryImpl : public DownloadItemFactory {
}
};
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+base::FilePath GetTemporaryDownloadDirectory() {
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ return base::nix::GetXDGDirectory(env.get(), "XDG_DATA_HOME", ".local/share");
+}
+#endif
+
} // namespace
DownloadManagerImpl::DownloadManagerImpl(net::NetLog* net_log,
@@ -359,12 +370,20 @@ void DownloadManagerImpl::StartDownloadWithId(
}
base::FilePath default_download_directory;
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ // TODO(thomasanderson): Remove this when all Linux distros with
+ // versions of GTK lower than 3.14.7 are no longer supported. This
+ // should happen when support for Ubuntu Trusty and Debian Jessie
+ // are removed.
+ default_download_directory = GetTemporaryDownloadDirectory();
+#else
if (delegate_) {
base::FilePath website_save_directory; // Unused
bool skip_dir_check = false; // Unused
delegate_->GetSaveDir(GetBrowserContext(), &website_save_directory,
&default_download_directory, &skip_dir_check);
}
+#endif
std::unique_ptr<DownloadFile> download_file;
« no previous file with comments | « no previous file | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698