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