OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Download utility implementation | 5 // Download utility implementation |
6 | 6 |
7 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &path_)) { | 102 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &path_)) { |
103 NOTREACHED(); | 103 NOTREACHED(); |
104 } | 104 } |
105 } | 105 } |
106 } | 106 } |
107 friend struct base::DefaultLazyInstanceTraits<DefaultDownloadDirectory>; | 107 friend struct base::DefaultLazyInstanceTraits<DefaultDownloadDirectory>; |
108 FilePath path_; | 108 FilePath path_; |
109 }; | 109 }; |
110 | 110 |
111 static base::LazyInstance<DefaultDownloadDirectory> | 111 static base::LazyInstance<DefaultDownloadDirectory> |
112 g_default_download_directory(base::LINKER_INITIALIZED); | 112 g_default_download_directory = LAZY_INSTANCE_INITIALIZER; |
113 | 113 |
114 const FilePath& GetDefaultDownloadDirectory() { | 114 const FilePath& GetDefaultDownloadDirectory() { |
115 return g_default_download_directory.Get().path(); | 115 return g_default_download_directory.Get().path(); |
116 } | 116 } |
117 | 117 |
118 bool DownloadPathIsDangerous(const FilePath& download_path) { | 118 bool DownloadPathIsDangerous(const FilePath& download_path) { |
119 FilePath desktop_dir; | 119 FilePath desktop_dir; |
120 if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { | 120 if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) { |
121 NOTREACHED(); | 121 NOTREACHED(); |
122 return false; | 122 return false; |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 return DownloadFile::GetUniquePathNumberWithSuffix( | 565 return DownloadFile::GetUniquePathNumberWithSuffix( |
566 path, FILE_PATH_LITERAL(".crdownload")); | 566 path, FILE_PATH_LITERAL(".crdownload")); |
567 } | 567 } |
568 | 568 |
569 FilePath GetCrDownloadPath(const FilePath& suggested_path) { | 569 FilePath GetCrDownloadPath(const FilePath& suggested_path) { |
570 return DownloadFile::AppendSuffixToPath( | 570 return DownloadFile::AppendSuffixToPath( |
571 suggested_path, FILE_PATH_LITERAL(".crdownload")); | 571 suggested_path, FILE_PATH_LITERAL(".crdownload")); |
572 } | 572 } |
573 | 573 |
574 } // namespace download_util | 574 } // namespace download_util |
OLD | NEW |