OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // Helper function for download views to use when acting as a drag source for a | 124 // Helper function for download views to use when acting as a drag source for a |
125 // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| | 125 // DownloadItem. If |icon| is NULL, no image will be accompany the drag. |view| |
126 // is only required for Mac OS X, elsewhere it can be NULL. | 126 // is only required for Mac OS X, elsewhere it can be NULL. |
127 void DragDownload(const content::DownloadItem* download, | 127 void DragDownload(const content::DownloadItem* download, |
128 gfx::Image* icon, | 128 gfx::Image* icon, |
129 gfx::NativeView view); | 129 gfx::NativeView view); |
130 | 130 |
131 // Helpers --------------------------------------------------------------------- | 131 // Helpers --------------------------------------------------------------------- |
132 | 132 |
133 // Creates a representation of a download in a format that the downloads | |
134 // HTML page can understand. | |
135 base::DictionaryValue* CreateDownloadItemValue(content::DownloadItem* download, | |
136 int id); | |
137 | |
138 // Get the localized status text for an in-progress download. | 133 // Get the localized status text for an in-progress download. |
139 string16 GetProgressStatusText(content::DownloadItem* download); | 134 string16 GetProgressStatusText(content::DownloadItem* download); |
140 | 135 |
141 // Update the application icon to indicate overall download progress. | 136 // Update the application icon to indicate overall download progress. |
142 // |download_count| is the number of downloads currently in progress. If | 137 // |download_count| is the number of downloads currently in progress. If |
143 // |progress_known| is false, then at least one download is of indeterminate | 138 // |progress_known| is false, then at least one download is of indeterminate |
144 // size and |progress| is invalid, otherwise |progress| indicates the overall | 139 // size and |progress| is invalid, otherwise |progress| indicates the overall |
145 // download progress (float value from 0..1). | 140 // download progress (float value from 0..1). |
146 void UpdateAppIconDownloadProgress(int download_count, | 141 void UpdateAppIconDownloadProgress(int download_count, |
147 bool progress_known, | 142 bool progress_known, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 193 |
199 // Increment one of the above counts. | 194 // Increment one of the above counts. |
200 void RecordDownloadCount(ChromeDownloadCountTypes type); | 195 void RecordDownloadCount(ChromeDownloadCountTypes type); |
201 | 196 |
202 // Record initiation of a download from a specific source. | 197 // Record initiation of a download from a specific source. |
203 void RecordDownloadSource(ChromeDownloadSource source); | 198 void RecordDownloadSource(ChromeDownloadSource source); |
204 | 199 |
205 } // namespace download_util | 200 } // namespace download_util |
206 | 201 |
207 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 202 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
OLD | NEW |