| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 int render_process_host_id, | 187 int render_process_host_id, |
| 188 int render_view_id, | 188 int render_view_id, |
| 189 URLRequestContextGetter* request_context_getter); | 189 URLRequestContextGetter* request_context_getter); |
| 190 | 190 |
| 191 // Tells the resource dispatcher host to cancel a download request. | 191 // Tells the resource dispatcher host to cancel a download request. |
| 192 // Must be called on the IO thread. | 192 // Must be called on the IO thread. |
| 193 void CancelDownloadRequest(ResourceDispatcherHost* rdh, | 193 void CancelDownloadRequest(ResourceDispatcherHost* rdh, |
| 194 int render_process_id, | 194 int render_process_id, |
| 195 int request_id); | 195 int request_id); |
| 196 | 196 |
| 197 // Sends a notification on downloads being initiated |
| 198 // Must be called on the UI thread. |
| 199 void NotifyDownloadInitiated(int render_process_id, int render_view_id); |
| 200 |
| 197 // Same as GetUniquePathNumber, except that it also checks the existence | 201 // Same as GetUniquePathNumber, except that it also checks the existence |
| 198 // of its .crdownload intermediate path. | 202 // of its .crdownload intermediate path. |
| 199 // If |path| does not exist, 0 is returned. If it fails to find such | 203 // If |path| does not exist, 0 is returned. If it fails to find such |
| 200 // a number, -1 is returned. | 204 // a number, -1 is returned. |
| 201 int GetUniquePathNumberWithCrDownload(const FilePath& path); | 205 int GetUniquePathNumberWithCrDownload(const FilePath& path); |
| 202 | 206 |
| 203 // Erases all downloaded files with the specified path and name prefix. | 207 // Erases all downloaded files with the specified path and name prefix. |
| 204 // Used by download UI tests to clean up the download directory. | 208 // Used by download UI tests to clean up the download directory. |
| 205 void EraseUniqueDownloadFiles(const FilePath& path_prefix); | 209 void EraseUniqueDownloadFiles(const FilePath& path_prefix); |
| 206 | 210 |
| 207 // Returns a .crdownload intermediate path for the |suggested_path|. | 211 // Returns a .crdownload intermediate path for the |suggested_path|. |
| 208 FilePath GetCrDownloadPath(const FilePath& suggested_path); | 212 FilePath GetCrDownloadPath(const FilePath& suggested_path); |
| 209 | 213 |
| 210 // Returns true if this download should show the "dangerous file" warning. | 214 // Returns true if this download should show the "dangerous file" warning. |
| 211 // Various factors are considered, such as the type of the file, whether a | 215 // Various factors are considered, such as the type of the file, whether a |
| 212 // user action initiated the download, and whether the user has explictly | 216 // user action initiated the download, and whether the user has explictly |
| 213 // marked the file type as "auto open". | 217 // marked the file type as "auto open". |
| 214 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); | 218 bool IsDangerous(DownloadCreateInfo* info, Profile* profile, bool auto_open); |
| 215 | 219 |
| 216 } // namespace download_util | 220 } // namespace download_util |
| 217 | 221 |
| 218 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ | 222 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UTIL_H_ |
| OLD | NEW |