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 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
8 // active profile in Chrome. | 8 // active profile in Chrome. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Various factors are considered, such as the type of the file, whether a | 228 // Various factors are considered, such as the type of the file, whether a |
229 // user action initiated the download, and whether the user has explicitly | 229 // user action initiated the download, and whether the user has explicitly |
230 // marked the file type as "auto open". | 230 // marked the file type as "auto open". |
231 bool IsDangerous(const DownloadItem& download, | 231 bool IsDangerous(const DownloadItem& download, |
232 const DownloadStateInfo& state, | 232 const DownloadStateInfo& state, |
233 bool visited_referrer_before); | 233 bool visited_referrer_before); |
234 | 234 |
235 // Called when the user has validated the download of a dangerous file. | 235 // Called when the user has validated the download of a dangerous file. |
236 void DangerousDownloadValidated(DownloadItem* download); | 236 void DangerousDownloadValidated(DownloadItem* download); |
237 | 237 |
| 238 // Checks whether downloaded files still exist. Updates state of downloads |
| 239 // that refer to removed files. The check runs in the background and may |
| 240 // finish asynchronously after this method returns. |
| 241 void CheckForHistoryFilesRemoval(); |
| 242 |
| 243 // Checks whether a downloaded file still exists and updates the file's state |
| 244 // if the file is already removed. The check runs in the background and may |
| 245 // finish asynchronously after this method returns. |
| 246 void CheckForFileRemoval(DownloadItem* download_item); |
| 247 |
238 // Callback function after url is checked with safebrowsing service. | 248 // Callback function after url is checked with safebrowsing service. |
239 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); | 249 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); |
240 | 250 |
241 // Callback function after we check whether the referrer URL has been visited | 251 // Callback function after we check whether the referrer URL has been visited |
242 // before today. | 252 // before today. |
243 void CheckVisitedReferrerBeforeDone(int32 download_id, | 253 void CheckVisitedReferrerBeforeDone(int32 download_id, |
244 bool visited_referrer_before); | 254 bool visited_referrer_before); |
245 | 255 |
246 // Callback function after download file hash is checked with safebrowsing | 256 // Callback function after download file hash is checked with safebrowsing |
247 // service. | 257 // service. |
(...skipping 28 matching lines...) Expand all Loading... |
276 // The original profile's download manager. | 286 // The original profile's download manager. |
277 DownloadManager* observed_download_manager_; | 287 DownloadManager* observed_download_manager_; |
278 }; | 288 }; |
279 | 289 |
280 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 290 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
281 friend class DeleteTask<DownloadManager>; | 291 friend class DeleteTask<DownloadManager>; |
282 friend class OtherDownloadManagerObserver; | 292 friend class OtherDownloadManagerObserver; |
283 | 293 |
284 virtual ~DownloadManager(); | 294 virtual ~DownloadManager(); |
285 | 295 |
| 296 // Called on the FILE thread to check the existence of a downloaded file. |
| 297 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path); |
| 298 |
| 299 // Called on the UI thread if the FILE thread detects the removal of |
| 300 // the downloaded file. The UI thread updates the state of the file |
| 301 // and then notifies this update to the file's observer. |
| 302 void OnFileRemovalDetected(int64 db_handle); |
| 303 |
286 // Called on the download thread to check whether the suggested file path | 304 // Called on the download thread to check whether the suggested file path |
287 // exists. We don't check if the file exists on the UI thread to avoid UI | 305 // exists. We don't check if the file exists on the UI thread to avoid UI |
288 // stalls from interacting with the file system. | 306 // stalls from interacting with the file system. |
289 void CheckIfSuggestedPathExists(int32 download_id, | 307 void CheckIfSuggestedPathExists(int32 download_id, |
290 DownloadStateInfo state, | 308 DownloadStateInfo state, |
291 const FilePath& default_path); | 309 const FilePath& default_path); |
292 | 310 |
293 // Called on the UI thread once the DownloadManager has determined whether the | 311 // Called on the UI thread once the DownloadManager has determined whether the |
294 // suggested file path exists. | 312 // suggested file path exists. |
295 void OnPathExistenceAvailable(int32 download_id, | 313 void OnPathExistenceAvailable(int32 download_id, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // The "Save As" dialog box used to ask the user where a file should be | 424 // The "Save As" dialog box used to ask the user where a file should be |
407 // saved. | 425 // saved. |
408 scoped_refptr<SelectFileDialog> select_file_dialog_; | 426 scoped_refptr<SelectFileDialog> select_file_dialog_; |
409 | 427 |
410 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 428 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
411 | 429 |
412 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 430 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
413 }; | 431 }; |
414 | 432 |
415 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 433 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |