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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 void PaintDownloadComplete(gfx::Canvas* canvas, | 135 void PaintDownloadComplete(gfx::Canvas* canvas, |
136 #if defined(TOOLKIT_VIEWS) | 136 #if defined(TOOLKIT_VIEWS) |
137 views::View* containing_view, | 137 views::View* containing_view, |
138 #endif | 138 #endif |
139 int origin_x, | 139 int origin_x, |
140 int origin_y, | 140 int origin_y, |
141 double animation_progress, | 141 double animation_progress, |
142 PaintDownloadProgressSize size); | 142 PaintDownloadProgressSize size); |
143 | 143 |
| 144 void PaintDownloadInterrupted(gfx::Canvas* canvas, |
| 145 #if defined(TOOLKIT_VIEWS) |
| 146 views::View* containing_view, |
| 147 #endif |
| 148 int origin_x, |
| 149 int origin_y, |
| 150 double animation_progress, |
| 151 PaintDownloadProgressSize size); |
| 152 |
144 // Drag support ---------------------------------------------------------------- | 153 // Drag support ---------------------------------------------------------------- |
145 | 154 |
146 // Helper function for download views to use when acting as a drag source for a | 155 // 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| | 156 // 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. | 157 // is only required for Mac OS X, elsewhere it can be NULL. |
149 void DragDownload(const DownloadItem* download, | 158 void DragDownload(const DownloadItem* download, |
150 SkBitmap* icon, | 159 SkBitmap* icon, |
151 gfx::NativeView view); | 160 gfx::NativeView view); |
152 | 161 |
153 // Executable file support ----------------------------------------------------- | 162 // Executable file support ----------------------------------------------------- |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Download the URL. Must be called on the IO thread. | 200 // Download the URL. Must be called on the IO thread. |
192 void DownloadUrl(const GURL& url, | 201 void DownloadUrl(const GURL& url, |
193 const GURL& referrer, | 202 const GURL& referrer, |
194 const std::string& referrer_charset, | 203 const std::string& referrer_charset, |
195 const DownloadSaveInfo& save_info, | 204 const DownloadSaveInfo& save_info, |
196 ResourceDispatcherHost* rdh, | 205 ResourceDispatcherHost* rdh, |
197 int render_process_host_id, | 206 int render_process_host_id, |
198 int render_view_id, | 207 int render_view_id, |
199 URLRequestContextGetter* request_context_getter); | 208 URLRequestContextGetter* request_context_getter); |
200 | 209 |
| 210 // Restart the URL download. Must be called on the IO thread. |
| 211 void RestartDownloadUrl(ResourceDispatcherHost* rdh, |
| 212 const GURL& url, |
| 213 const GURL& referrer, |
| 214 const FilePath& path, |
| 215 int64 start_offset, |
| 216 int render_process_host_id, |
| 217 int render_view_id); |
| 218 |
201 // Tells the resource dispatcher host to cancel a download request. | 219 // Tells the resource dispatcher host to cancel a download request. |
202 // Must be called on the IO thread. | 220 // Must be called on the IO thread. |
203 void CancelDownloadRequest(ResourceDispatcherHost* rdh, | 221 void CancelDownloadRequest(ResourceDispatcherHost* rdh, |
204 int render_process_id, | 222 int render_process_id, |
205 int request_id); | 223 int request_id); |
206 | 224 |
207 // Same as GetUniquePathNumber, except that it also checks the existence | 225 // Same as GetUniquePathNumber, except that it also checks the existence |
208 // of its .crdownload intermediate path. | 226 // of its .crdownload intermediate path. |
209 // If |path| does not exist, 0 is returned. If it fails to find such | 227 // If |path| does not exist, 0 is returned. If it fails to find such |
210 // a number, -1 is returned. | 228 // a number, -1 is returned. |
211 int GetUniquePathNumberWithCrDownload(const FilePath& path); | 229 int GetUniquePathNumberWithCrDownload(const FilePath& path); |
212 | 230 |
213 // Returns a .crdownload intermediate path for the |suggested_path|. | 231 // Returns a .crdownload intermediate path for the |suggested_path|. |
214 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 232 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
215 | 233 |
| 234 // Removes a .crdownload from |cr_path| to get the original path. |
| 235 FilePath RemoveCrDownloadPath(const FilePath& cr_path); |
| 236 |
| 237 // Checks if the |path| is a temporary (.crdownload) path. |
| 238 bool IsCrDownloadPath(const FilePath& path); |
| 239 |
216 } // namespace download_util | 240 } // namespace download_util |
217 | 241 |
218 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 242 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
OLD | NEW |