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