OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 utilities. | 5 // Download utilities. |
6 | 6 |
7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 7 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 8 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 // Drag support ---------------------------------------------------------------- | 144 // Drag support ---------------------------------------------------------------- |
145 | 145 |
146 // Helper function for download views to use when acting as a drag source for a | 146 // Helper function for download views to use when acting as a drag source for a |
147 // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| | 147 // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| |
148 // is only required for Mac OS X, elsewhere it can be NULL. | 148 // is only required for Mac OS X, elsewhere it can be NULL. |
149 void DragDownload(const DownloadItem* download, | 149 void DragDownload(const DownloadItem* download, |
150 SkBitmap* icon, | 150 SkBitmap* icon, |
151 gfx::NativeView view); | 151 gfx::NativeView view); |
152 | 152 |
153 // Executable file support ----------------------------------------------------- | |
154 | |
155 // Tests if a file is considered executable, based on its type. | |
156 bool IsExecutableFile(const FilePath& path); | |
157 | |
158 // Determine if the specified extension is an executable extension. | |
159 bool IsExecutableExtension(const FilePath::StringType& extension); | |
160 | |
161 // Tests if we think the server means for this mime_type to be executable. | |
162 bool IsExecutableMimeType(const std::string& mime_type); | |
163 | |
164 // Helpers --------------------------------------------------------------------- | 153 // Helpers --------------------------------------------------------------------- |
165 | 154 |
166 // Creates a representation of a download in a format that the downloads | 155 // Creates a representation of a download in a format that the downloads |
167 // HTML page can understand. | 156 // HTML page can understand. |
168 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id); | 157 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id); |
169 | 158 |
170 // Get the localized status text for an in-progress download. | 159 // Get the localized status text for an in-progress download. |
171 std::wstring GetProgressStatusText(DownloadItem* download); | 160 std::wstring GetProgressStatusText(DownloadItem* download); |
172 | 161 |
173 // Update the application icon to indicate overall download progress. | 162 // Update the application icon to indicate overall download progress. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 205 |
217 // Returns a .crdownload intermediate path for the |suggested_path|. | 206 // Returns a .crdownload intermediate path for the |suggested_path|. |
218 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 207 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
219 | 208 |
220 // Whether a given download should be considered potentially dangerous. | 209 // Whether a given download should be considered potentially dangerous. |
221 bool IsDangerous(DownloadCreateInfo *info, Profile* profile); | 210 bool IsDangerous(DownloadCreateInfo *info, Profile* profile); |
222 | 211 |
223 } // namespace download_util | 212 } // namespace download_util |
224 | 213 |
225 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 214 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
OLD | NEW |