| Index: chrome/browser/download/download_util.cc
|
| diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
|
| index 06c03b2b38b9b3e2e34ee3dcb2fb75043f7e8770..ebaac451da4d6fe8a9bff5178146317ac77f040d 100644
|
| --- a/chrome/browser/download/download_util.cc
|
| +++ b/chrome/browser/download/download_util.cc
|
| @@ -203,36 +203,16 @@ void GenerateFileNameInternal(const GURL& url,
|
|
|
| // Download temporary file creation --------------------------------------------
|
|
|
| -class DefaultDownloadDirectory {
|
| - public:
|
| - const FilePath& path() const { return path_; }
|
| - private:
|
| - DefaultDownloadDirectory() {
|
| - if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &path_)) {
|
| +FilePath GetDefaultDownloadDirectoryFromPathService() {
|
| + FilePath default_download_dir;
|
| + if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &default_download_dir))
|
| + NOTREACHED();
|
| + if (DownloadPathIsDangerous(default_download_dir)) {
|
| + if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE,
|
| + &default_download_dir))
|
| NOTREACHED();
|
| - }
|
| - if (DownloadPathIsDangerous(path_)) {
|
| - if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &path_)) {
|
| - NOTREACHED();
|
| - }
|
| - }
|
| }
|
| - friend struct base::DefaultLazyInstanceTraits<DefaultDownloadDirectory>;
|
| - FilePath path_;
|
| -};
|
| -
|
| -static base::LazyInstance<DefaultDownloadDirectory>
|
| - g_default_download_directory(base::LINKER_INITIALIZED);
|
| -
|
| -const FilePath& GetDefaultDownloadDirectory() {
|
| - return g_default_download_directory.Get().path();
|
| -}
|
| -
|
| -bool CreateTemporaryFileForDownload(FilePath* temp_file) {
|
| - if (file_util::CreateTemporaryFileInDir(GetDefaultDownloadDirectory(),
|
| - temp_file))
|
| - return true;
|
| - return file_util::CreateTemporaryFile(temp_file);
|
| + return default_download_dir;
|
| }
|
|
|
| bool DownloadPathIsDangerous(const FilePath& download_path) {
|
|
|