| 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 |
| 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/string16.h" |
| 15 #include "gfx/native_widget_types.h" | 16 #include "gfx/native_widget_types.h" |
| 16 | 17 |
| 17 #if defined(TOOLKIT_VIEWS) | 18 #if defined(TOOLKIT_VIEWS) |
| 18 #include "views/view.h" | 19 #include "views/view.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 class Canvas; | 23 class Canvas; |
| 23 } | 24 } |
| 24 | 25 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 SkBitmap* icon, | 151 SkBitmap* icon, |
| 151 gfx::NativeView view); | 152 gfx::NativeView view); |
| 152 | 153 |
| 153 // Helpers --------------------------------------------------------------------- | 154 // Helpers --------------------------------------------------------------------- |
| 154 | 155 |
| 155 // Creates a representation of a download in a format that the downloads | 156 // Creates a representation of a download in a format that the downloads |
| 156 // HTML page can understand. | 157 // HTML page can understand. |
| 157 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id); | 158 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id); |
| 158 | 159 |
| 159 // Get the localized status text for an in-progress download. | 160 // Get the localized status text for an in-progress download. |
| 160 std::wstring GetProgressStatusText(DownloadItem* download); | 161 string16 GetProgressStatusText(DownloadItem* download); |
| 161 | 162 |
| 162 // Update the application icon to indicate overall download progress. | 163 // Update the application icon to indicate overall download progress. |
| 163 // |download_count| is the number of downloads currently in progress. If | 164 // |download_count| is the number of downloads currently in progress. If |
| 164 // |progress_known| is false, then at least one download is of indeterminate | 165 // |progress_known| is false, then at least one download is of indeterminate |
| 165 // size and |progress| is invalid, otherwise |progress| indicates the overall | 166 // size and |progress| is invalid, otherwise |progress| indicates the overall |
| 166 // download progress (float value from 0..1). | 167 // download progress (float value from 0..1). |
| 167 void UpdateAppIconDownloadProgress(int download_count, | 168 void UpdateAppIconDownloadProgress(int download_count, |
| 168 bool progress_known, | 169 bool progress_known, |
| 169 float progress); | 170 float progress); |
| 170 | 171 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 206 |
| 206 // Returns a .crdownload intermediate path for the |suggested_path|. | 207 // Returns a .crdownload intermediate path for the |suggested_path|. |
| 207 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 208 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
| 208 | 209 |
| 209 // Whether a given download should be considered potentially dangerous. | 210 // Whether a given download should be considered potentially dangerous. |
| 210 bool IsDangerous(DownloadCreateInfo *info, Profile* profile); | 211 bool IsDangerous(DownloadCreateInfo *info, Profile* profile); |
| 211 | 212 |
| 212 } // namespace download_util | 213 } // namespace download_util |
| 213 | 214 |
| 214 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 215 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| OLD | NEW |