OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Objects that handle file operations for downloads, on the download thread. | 5 // Objects that handle file operations for downloads, on the download thread. |
6 // | 6 // |
7 // The DownloadFileManager owns a set of DownloadFile objects, each of which | 7 // The DownloadFileManager owns a set of DownloadFile objects, each of which |
8 // represent one in progress download and performs the disk IO for that | 8 // represent one in progress download and performs the disk IO for that |
9 // download. The DownloadFileManager itself is a singleton object owned by the | 9 // download. The DownloadFileManager itself is a singleton object owned by the |
10 // ResourceDispatcherHost. | 10 // ResourceDispatcherHost. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 // Timer notifications. | 204 // Timer notifications. |
205 void UpdateInProgressDownloads(); | 205 void UpdateInProgressDownloads(); |
206 | 206 |
207 MessageLoop* file_loop() const { return file_loop_; } | 207 MessageLoop* file_loop() const { return file_loop_; } |
208 | 208 |
209 // Called by the download manager at initialization to ensure the default | 209 // Called by the download manager at initialization to ensure the default |
210 // download directory exists. | 210 // download directory exists. |
211 void CreateDirectory(const std::wstring& directory); | 211 void CreateDirectory(const std::wstring& directory); |
212 | 212 |
| 213 // Called by the donwload manager to delete non validated dangerous downloads. |
| 214 void DeleteFile(const std::wstring& path); |
| 215 |
213 private: | 216 private: |
214 // Timer helpers for updating the UI about the current progress of a download. | 217 // Timer helpers for updating the UI about the current progress of a download. |
215 void StartUpdateTimer(); | 218 void StartUpdateTimer(); |
216 void StopUpdateTimer(); | 219 void StopUpdateTimer(); |
217 | 220 |
218 // Clean up helper that runs on the download thread. | 221 // Clean up helper that runs on the download thread. |
219 void OnShutdown(); | 222 void OnShutdown(); |
220 | 223 |
221 // Called only on UI thread to get the DownloadManager for a tab's profile. | 224 // Called only on UI thread to get the DownloadManager for a tab's profile. |
222 static DownloadManager* DownloadManagerFromRenderIds(int render_process_id, | 225 static DownloadManager* DownloadManagerFromRenderIds(int render_process_id, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // Used for progress updates on the UI thread, mapping download->id() to bytes | 267 // Used for progress updates on the UI thread, mapping download->id() to bytes |
265 // received so far. Written to by the file thread and read by the UI thread. | 268 // received so far. Written to by the file thread and read by the UI thread. |
266 typedef base::hash_map<int, int64> ProgressMap; | 269 typedef base::hash_map<int, int64> ProgressMap; |
267 ProgressMap ui_progress_; | 270 ProgressMap ui_progress_; |
268 Lock progress_lock_; | 271 Lock progress_lock_; |
269 | 272 |
270 DISALLOW_EVIL_CONSTRUCTORS(DownloadFileManager); | 273 DISALLOW_EVIL_CONSTRUCTORS(DownloadFileManager); |
271 }; | 274 }; |
272 | 275 |
273 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ | 276 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ |
OLD | NEW |