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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // of downloads. | 79 // of downloads. |
80 virtual void ModelChanged() = 0; | 80 virtual void ModelChanged() = 0; |
81 | 81 |
82 // Called when the DownloadManager is being destroyed to prevent Observers | 82 // Called when the DownloadManager is being destroyed to prevent Observers |
83 // from calling back to a stale pointer. | 83 // from calling back to a stale pointer. |
84 virtual void ManagerGoingDown() {} | 84 virtual void ManagerGoingDown() {} |
85 | 85 |
86 // Called immediately after the DownloadManager puts up a select file | 86 // Called immediately after the DownloadManager puts up a select file |
87 // dialog. | 87 // dialog. |
88 // |id| indicates which download opened the dialog. | 88 // |id| indicates which download opened the dialog. |
89 virtual void SelectFileDialogDisplayed(int32 id) {} | 89 // |suggested_path| indicates the path suggested in the dialog. |
| 90 virtual void SelectFileDialogDisplayed( |
| 91 int32 id, const FilePath& suggested_path) {} |
90 | 92 |
91 protected: | 93 protected: |
92 virtual ~Observer() {} | 94 virtual ~Observer() {} |
93 }; | 95 }; |
94 | 96 |
95 // Return all temporary downloads that reside in the specified directory. | 97 // Return all temporary downloads that reside in the specified directory. |
96 void GetTemporaryDownloads(const FilePath& dir_path, | 98 void GetTemporaryDownloads(const FilePath& dir_path, |
97 std::vector<DownloadItem*>* result); | 99 std::vector<DownloadItem*>* result); |
98 | 100 |
99 // Return all non-temporary downloads in the specified directory that are | 101 // Return all non-temporary downloads in the specified directory that are |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // Called on the UI thread if the FILE thread detects the removal of | 301 // 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 | 302 // the downloaded file. The UI thread updates the state of the file |
301 // and then notifies this update to the file's observer. | 303 // and then notifies this update to the file's observer. |
302 void OnFileRemovalDetected(int64 db_handle); | 304 void OnFileRemovalDetected(int64 db_handle); |
303 | 305 |
304 // Called on the download thread to check whether the suggested file path | 306 // Called on the download thread to check whether the suggested file path |
305 // exists. We don't check if the file exists on the UI thread to avoid UI | 307 // exists. We don't check if the file exists on the UI thread to avoid UI |
306 // stalls from interacting with the file system. | 308 // stalls from interacting with the file system. |
307 void CheckIfSuggestedPathExists(int32 download_id, | 309 void CheckIfSuggestedPathExists(int32 download_id, |
308 DownloadStateInfo state, | 310 DownloadStateInfo state, |
309 const FilePath& default_path); | 311 const FilePath& download_save_dir, |
| 312 const FilePath& default_download_dir); |
310 | 313 |
311 // Called on the UI thread once the DownloadManager has determined whether the | 314 // Called on the UI thread once the DownloadManager has determined whether the |
312 // suggested file path exists. | 315 // suggested file path exists. |
313 void OnPathExistenceAvailable(int32 download_id, | 316 void OnPathExistenceAvailable(int32 download_id, |
314 DownloadStateInfo new_state); | 317 DownloadStateInfo new_state); |
315 | 318 |
316 // Called back after a target path for the file to be downloaded to has been | 319 // Called back after a target path for the file to be downloaded to has been |
317 // determined, either automatically based on the suggested file name, or by | 320 // determined, either automatically based on the suggested file name, or by |
318 // the user in a Save As dialog box. | 321 // the user in a Save As dialog box. |
319 void ContinueDownloadWithPath(DownloadItem* download, | 322 void ContinueDownloadWithPath(DownloadItem* download, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // The "Save As" dialog box used to ask the user where a file should be | 427 // The "Save As" dialog box used to ask the user where a file should be |
425 // saved. | 428 // saved. |
426 scoped_refptr<SelectFileDialog> select_file_dialog_; | 429 scoped_refptr<SelectFileDialog> select_file_dialog_; |
427 | 430 |
428 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 431 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
429 | 432 |
430 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 433 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
431 }; | 434 }; |
432 | 435 |
433 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 436 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |