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 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 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "ui/gfx/native_widget_types.h" | 17 #include "ui/gfx/native_widget_types.h" |
18 | 18 |
19 #if defined(TOOLKIT_VIEWS) | 19 #if defined(TOOLKIT_VIEWS) |
20 #include "views/view.h" | 20 #include "views/view.h" |
21 #endif | 21 #endif |
22 | 22 |
23 class BaseDownloadItemModel; | 23 class BaseDownloadItemModel; |
24 class CrxInstaller; | 24 class CrxInstaller; |
25 class DictionaryValue; | |
26 class DownloadItem; | 25 class DownloadItem; |
27 class DownloadManager; | 26 class DownloadManager; |
28 class GURL; | 27 class GURL; |
29 class Profile; | 28 class Profile; |
30 class ResourceDispatcherHost; | 29 class ResourceDispatcherHost; |
31 class SkBitmap; | 30 class SkBitmap; |
32 | 31 |
33 struct DownloadCreateInfo; | 32 struct DownloadCreateInfo; |
34 struct DownloadSaveInfo; | 33 struct DownloadSaveInfo; |
35 | 34 |
36 namespace base { | 35 namespace base { |
| 36 class DictionaryValue; |
37 class TimeTicks; | 37 class TimeTicks; |
38 } | 38 } |
39 | 39 |
40 namespace content { | 40 namespace content { |
41 class ResourceContext; | 41 class ResourceContext; |
42 } | 42 } |
43 | 43 |
44 namespace gfx { | 44 namespace gfx { |
45 class Canvas; | 45 class Canvas; |
46 class Image; | 46 class Image; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| | 220 // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| |
221 // is only required for Mac OS X, elsewhere it can be NULL. | 221 // is only required for Mac OS X, elsewhere it can be NULL. |
222 void DragDownload(const DownloadItem* download, | 222 void DragDownload(const DownloadItem* download, |
223 gfx::Image* icon, | 223 gfx::Image* icon, |
224 gfx::NativeView view); | 224 gfx::NativeView view); |
225 | 225 |
226 // Helpers --------------------------------------------------------------------- | 226 // Helpers --------------------------------------------------------------------- |
227 | 227 |
228 // Creates a representation of a download in a format that the downloads | 228 // Creates a representation of a download in a format that the downloads |
229 // HTML page can understand. | 229 // HTML page can understand. |
230 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id); | 230 base::DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id); |
231 | 231 |
232 // Get the localized status text for an in-progress download. | 232 // Get the localized status text for an in-progress download. |
233 string16 GetProgressStatusText(DownloadItem* download); | 233 string16 GetProgressStatusText(DownloadItem* download); |
234 | 234 |
235 // Update the application icon to indicate overall download progress. | 235 // Update the application icon to indicate overall download progress. |
236 // |download_count| is the number of downloads currently in progress. If | 236 // |download_count| is the number of downloads currently in progress. If |
237 // |progress_known| is false, then at least one download is of indeterminate | 237 // |progress_known| is false, then at least one download is of indeterminate |
238 // size and |progress| is invalid, otherwise |progress| indicates the overall | 238 // size and |progress| is invalid, otherwise |progress| indicates the overall |
239 // download progress (float value from 0..1). | 239 // download progress (float value from 0..1). |
240 void UpdateAppIconDownloadProgress(int download_count, | 240 void UpdateAppIconDownloadProgress(int download_count, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // Erases all downloaded files with the specified path and name prefix. | 273 // Erases all downloaded files with the specified path and name prefix. |
274 // Used by download UI tests to clean up the download directory. | 274 // Used by download UI tests to clean up the download directory. |
275 void EraseUniqueDownloadFiles(const FilePath& path_prefix); | 275 void EraseUniqueDownloadFiles(const FilePath& path_prefix); |
276 | 276 |
277 // Returns a .crdownload intermediate path for the |suggested_path|. | 277 // Returns a .crdownload intermediate path for the |suggested_path|. |
278 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 278 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
279 | 279 |
280 } // namespace download_util | 280 } // namespace download_util |
281 | 281 |
282 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 282 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
OLD | NEW |