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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 virtual int64 GetReceivedDownloadBytes(); | 226 virtual int64 GetReceivedDownloadBytes(); |
227 virtual int64 GetTotalDownloadBytes(); | 227 virtual int64 GetTotalDownloadBytes(); |
228 | 228 |
229 // Overridden from SelectFileDialog::Listener: | 229 // Overridden from SelectFileDialog::Listener: |
230 virtual void FileSelected(const FilePath& path, int index, void* params); | 230 virtual void FileSelected(const FilePath& path, int index, void* params); |
231 virtual void FileSelectionCanceled(void* params); | 231 virtual void FileSelectionCanceled(void* params); |
232 | 232 |
233 // Called when the user has validated the download of a dangerous file. | 233 // Called when the user has validated the download of a dangerous file. |
234 void DangerousDownloadValidated(DownloadItem* download); | 234 void DangerousDownloadValidated(DownloadItem* download); |
235 | 235 |
| 236 // Checks whether downloaded files still exist. Updates state of downloads |
| 237 // that refer to removed files. The check runs in the background and may |
| 238 // finish asynchronously after this method returns. |
| 239 void CheckForFilesRemoval(); |
| 240 |
236 // Callback function after url is checked with safebrowsing service. | 241 // Callback function after url is checked with safebrowsing service. |
237 void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url); | 242 void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url); |
238 | 243 |
239 // Callback function after download file hash is checked with safebrowsing | 244 // Callback function after download file hash is checked with safebrowsing |
240 // service. | 245 // service. |
241 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); | 246 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); |
242 | 247 |
243 private: | 248 private: |
244 // For testing. | 249 // For testing. |
245 friend class DownloadManagerTest; | 250 friend class DownloadManagerTest; |
(...skipping 19 matching lines...) Expand all Loading... |
265 // The original profile's download manager. | 270 // The original profile's download manager. |
266 DownloadManager* observed_download_manager_; | 271 DownloadManager* observed_download_manager_; |
267 }; | 272 }; |
268 | 273 |
269 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 274 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
270 friend class DeleteTask<DownloadManager>; | 275 friend class DeleteTask<DownloadManager>; |
271 friend class OtherDownloadManagerObserver; | 276 friend class OtherDownloadManagerObserver; |
272 | 277 |
273 ~DownloadManager(); | 278 ~DownloadManager(); |
274 | 279 |
| 280 // Called on the FILE thread to check the existence of downloaded files. |
| 281 void CheckForFilesRemovalOnFileThread(int64 db_handle, const FilePath& path); |
| 282 |
| 283 // Called on the UI thread when the FILE thread finishes to check the |
| 284 // existence of downloaded files. The UI thread updates the state of the |
| 285 // downloaded but non-existent files, and then notifies the fact to the |
| 286 // observers of those files. |
| 287 void OnFilesRemovalDetected(int64 db_handle, bool file_exists); |
| 288 |
275 // Called on the download thread to check whether the suggested file path | 289 // Called on the download thread to check whether the suggested file path |
276 // exists. We don't check if the file exists on the UI thread to avoid UI | 290 // exists. We don't check if the file exists on the UI thread to avoid UI |
277 // stalls from interacting with the file system. | 291 // stalls from interacting with the file system. |
278 void CheckIfSuggestedPathExists(DownloadCreateInfo* info, | 292 void CheckIfSuggestedPathExists(DownloadCreateInfo* info, |
279 const FilePath& default_path); | 293 const FilePath& default_path); |
280 | 294 |
281 // Called on the UI thread once the DownloadManager has determined whether the | 295 // Called on the UI thread once the DownloadManager has determined whether the |
282 // suggested file path exists. | 296 // suggested file path exists. |
283 void OnPathExistenceAvailable(DownloadCreateInfo* info); | 297 void OnPathExistenceAvailable(DownloadCreateInfo* info); |
284 | 298 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // The "Save As" dialog box used to ask the user where a file should be | 407 // The "Save As" dialog box used to ask the user where a file should be |
394 // saved. | 408 // saved. |
395 scoped_refptr<SelectFileDialog> select_file_dialog_; | 409 scoped_refptr<SelectFileDialog> select_file_dialog_; |
396 | 410 |
397 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 411 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
398 | 412 |
399 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 413 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
400 }; | 414 }; |
401 | 415 |
402 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 416 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |