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 virtual void SelectFileDialogDisplayed(int32 id) {} | 90 // |suggested_path| indicates the path suggested in the dialog. |
| 91 virtual void SelectFileDialogDisplayed( |
| 92 int32 id, const FilePath& suggested_path) {} |
91 | 93 |
92 protected: | 94 protected: |
93 virtual ~Observer() {} | 95 virtual ~Observer() {} |
94 }; | 96 }; |
95 | 97 |
96 typedef std::vector<DownloadItem*> DownloadVector; | 98 typedef std::vector<DownloadItem*> DownloadVector; |
97 | 99 |
98 // Return all temporary downloads that reside in the specified directory. | 100 // Return all temporary downloads that reside in the specified directory. |
99 void GetTemporaryDownloads(const FilePath& dir_path, DownloadVector* result); | 101 void GetTemporaryDownloads(const FilePath& dir_path, DownloadVector* result); |
100 | 102 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Called on the UI thread if the FILE thread detects the removal of | 319 // Called on the UI thread if the FILE thread detects the removal of |
318 // the downloaded file. The UI thread updates the state of the file | 320 // the downloaded file. The UI thread updates the state of the file |
319 // and then notifies this update to the file's observer. | 321 // and then notifies this update to the file's observer. |
320 void OnFileRemovalDetected(int64 db_handle); | 322 void OnFileRemovalDetected(int64 db_handle); |
321 | 323 |
322 // Called on the download thread to check whether the suggested file path | 324 // Called on the download thread to check whether the suggested file path |
323 // exists. We don't check if the file exists on the UI thread to avoid UI | 325 // exists. We don't check if the file exists on the UI thread to avoid UI |
324 // stalls from interacting with the file system. | 326 // stalls from interacting with the file system. |
325 void CheckIfSuggestedPathExists(int32 download_id, | 327 void CheckIfSuggestedPathExists(int32 download_id, |
326 DownloadStateInfo state, | 328 DownloadStateInfo state, |
327 const FilePath& default_path); | 329 const FilePath& download_save_dir); |
328 | 330 |
329 // Called on the UI thread once the DownloadManager has determined whether the | 331 // Called on the UI thread once the DownloadManager has determined whether the |
330 // suggested file path exists. | 332 // suggested file path exists. |
331 void OnPathExistenceAvailable(int32 download_id, | 333 void OnPathExistenceAvailable(int32 download_id, |
332 const DownloadStateInfo& new_state); | 334 const DownloadStateInfo& new_state); |
333 | 335 |
334 // Called back after a target path for the file to be downloaded to has been | 336 // Called back after a target path for the file to be downloaded to has been |
335 // determined, either automatically based on the suggested file name, or by | 337 // determined, either automatically based on the suggested file name, or by |
336 // the user in a Save As dialog box. | 338 // the user in a Save As dialog box. |
337 void ContinueDownloadWithPath(DownloadItem* download, | 339 void ContinueDownloadWithPath(DownloadItem* download, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 | 442 |
441 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; | 443 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; |
442 | 444 |
443 // Allows an embedder to control behavior. Guaranteed to outlive this object. | 445 // Allows an embedder to control behavior. Guaranteed to outlive this object. |
444 DownloadManagerDelegate* delegate_; | 446 DownloadManagerDelegate* delegate_; |
445 | 447 |
446 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 448 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
447 }; | 449 }; |
448 | 450 |
449 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 451 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |