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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // of downloads. | 78 // of downloads. |
79 virtual void ModelChanged() = 0; | 79 virtual void ModelChanged() = 0; |
80 | 80 |
81 // Called when the DownloadManager is being destroyed to prevent Observers | 81 // Called when the DownloadManager is being destroyed to prevent Observers |
82 // from calling back to a stale pointer. | 82 // from calling back to a stale pointer. |
83 virtual void ManagerGoingDown() {} | 83 virtual void ManagerGoingDown() {} |
84 | 84 |
85 // Called immediately after the DownloadManager puts up a select file | 85 // Called immediately after the DownloadManager puts up a select file |
86 // dialog. | 86 // dialog. |
87 // |id| indicates which download opened the dialog. | 87 // |id| indicates which download opened the dialog. |
88 virtual void SelectFileDialogDisplayed(int32 id) {} | 88 // |suggested_path| indicates the path suggested in the dialog. |
| 89 virtual void SelectFileDialogDisplayed( |
| 90 int32 id, const FilePath& suggested_path) {} |
89 | 91 |
90 protected: | 92 protected: |
91 virtual ~Observer() {} | 93 virtual ~Observer() {} |
92 }; | 94 }; |
93 | 95 |
94 // Return all temporary downloads that reside in the specified directory. | 96 // Return all temporary downloads that reside in the specified directory. |
95 void GetTemporaryDownloads(const FilePath& dir_path, | 97 void GetTemporaryDownloads(const FilePath& dir_path, |
96 std::vector<DownloadItem*>* result); | 98 std::vector<DownloadItem*>* result); |
97 | 99 |
98 // Return all non-temporary downloads in the specified directory that are | 100 // Return all non-temporary downloads in the specified directory that are |
(...skipping 200 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); |
310 | 312 |
311 // Called on the UI thread once the DownloadManager has determined whether the | 313 // Called on the UI thread once the DownloadManager has determined whether the |
312 // suggested file path exists. | 314 // suggested file path exists. |
313 void OnPathExistenceAvailable(int32 download_id, | 315 void OnPathExistenceAvailable(int32 download_id, |
314 const DownloadStateInfo& new_state); | 316 const DownloadStateInfo& new_state); |
315 | 317 |
316 // Called back after a target path for the file to be downloaded to has been | 318 // 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 | 319 // determined, either automatically based on the suggested file name, or by |
318 // the user in a Save As dialog box. | 320 // the user in a Save As dialog box. |
319 void ContinueDownloadWithPath(DownloadItem* download, | 321 void ContinueDownloadWithPath(DownloadItem* download, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // The user's last choice for download directory. This is only used when the | 419 // The user's last choice for download directory. This is only used when the |
418 // user wants us to prompt for a save location for each download. | 420 // user wants us to prompt for a save location for each download. |
419 FilePath last_download_path_; | 421 FilePath last_download_path_; |
420 | 422 |
421 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 423 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
422 | 424 |
423 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 425 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
424 }; | 426 }; |
425 | 427 |
426 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 428 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |