| 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 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // Download the URL. Must be called on the IO thread. | 241 // Download the URL. Must be called on the IO thread. |
| 242 void DownloadUrl(const GURL& url, | 242 void DownloadUrl(const GURL& url, |
| 243 const GURL& referrer, | 243 const GURL& referrer, |
| 244 const std::string& referrer_charset, | 244 const std::string& referrer_charset, |
| 245 const DownloadSaveInfo& save_info, | 245 const DownloadSaveInfo& save_info, |
| 246 ResourceDispatcherHost* rdh, | 246 ResourceDispatcherHost* rdh, |
| 247 int render_process_host_id, | 247 int render_process_host_id, |
| 248 int render_view_id, | 248 int render_view_id, |
| 249 const content::ResourceContext* context); | 249 const content::ResourceContext* context); |
| 250 | 250 |
| 251 // Tells the resource dispatcher host to cancel a download request. | |
| 252 // Must be called on the IO thread. | |
| 253 // |process_handle| is passed by value because it is ultimately passed to | |
| 254 // other threads, and this way we don't have to worry about object lifetimes. | |
| 255 void CancelDownloadRequest(ResourceDispatcherHost* rdh, | |
| 256 DownloadProcessHandle process_handle); | |
| 257 | |
| 258 // Sends a notification on downloads being initiated | 251 // Sends a notification on downloads being initiated |
| 259 // Must be called on the UI thread. | 252 // Must be called on the UI thread. |
| 260 void NotifyDownloadInitiated(int render_process_id, int render_view_id); | 253 void NotifyDownloadInitiated(int render_process_id, int render_view_id); |
| 261 | 254 |
| 262 // Same as GetUniquePathNumber, except that it also checks the existence | 255 // Same as GetUniquePathNumber, except that it also checks the existence |
| 263 // of its .crdownload intermediate path. | 256 // of its .crdownload intermediate path. |
| 264 // If |path| does not exist, 0 is returned. If it fails to find such | 257 // If |path| does not exist, 0 is returned. If it fails to find such |
| 265 // a number, -1 is returned. | 258 // a number, -1 is returned. |
| 266 int GetUniquePathNumberWithCrDownload(const FilePath& path); | 259 int GetUniquePathNumberWithCrDownload(const FilePath& path); |
| 267 | 260 |
| 268 // Erases all downloaded files with the specified path and name prefix. | 261 // Erases all downloaded files with the specified path and name prefix. |
| 269 // Used by download UI tests to clean up the download directory. | 262 // Used by download UI tests to clean up the download directory. |
| 270 void EraseUniqueDownloadFiles(const FilePath& path_prefix); | 263 void EraseUniqueDownloadFiles(const FilePath& path_prefix); |
| 271 | 264 |
| 272 // Returns a .crdownload intermediate path for the |suggested_path|. | 265 // Returns a .crdownload intermediate path for the |suggested_path|. |
| 273 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 266 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
| 274 | 267 |
| 275 } // namespace download_util | 268 } // namespace download_util |
| 276 | 269 |
| 277 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 270 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| OLD | NEW |