| 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 browser context in Chrome. | 8 // active browser context in Chrome. |
| 9 // | 9 // |
| 10 // Download observers: | 10 // Download observers: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Returns all non-temporary downloads matching |query|. Empty query matches | 98 // Returns all non-temporary downloads matching |query|. Empty query matches |
| 99 // everything. | 99 // everything. |
| 100 virtual void SearchDownloads(const string16& query, | 100 virtual void SearchDownloads(const string16& query, |
| 101 DownloadVector* result) = 0; | 101 DownloadVector* result) = 0; |
| 102 | 102 |
| 103 // Returns true if initialized properly. | 103 // Returns true if initialized properly. |
| 104 virtual bool Init(content::BrowserContext* browser_context) = 0; | 104 virtual bool Init(content::BrowserContext* browser_context) = 0; |
| 105 | 105 |
| 106 // Notifications sent from the download thread to the UI thread | 106 // Notifications sent from the download thread to the UI thread |
| 107 virtual void StartDownload(int32 id) = 0; | 107 virtual void StartDownload(int32 id) = 0; |
| 108 virtual void UpdateDownload(int32 download_id, int64 size) = 0; | 108 virtual void UpdateDownload(int32 download_id, |
| 109 int64 size, |
| 110 std::string hash_state) = 0; |
| 109 | 111 |
| 110 // |download_id| is the ID of the download. | 112 // |download_id| is the ID of the download. |
| 111 // |size| is the number of bytes that have been downloaded. | 113 // |size| is the number of bytes that have been downloaded. |
| 112 // |hash| is sha256 hash for the downloaded file. It is empty when the hash | 114 // |hash| is sha256 hash for the downloaded file. It is empty when the hash |
| 113 // is not available. | 115 // is not available. |
| 114 virtual void OnResponseCompleted(int32 download_id, int64 size, | 116 virtual void OnResponseCompleted(int32 download_id, int64 size, |
| 115 const std::string& hash) = 0; | 117 const std::string& hash) = 0; |
| 116 | 118 |
| 117 // Offthread target for cancelling a particular download. Will be a no-op | 119 // Offthread target for cancelling a particular download. Will be a no-op |
| 118 // if the download has already been cancelled. | 120 // if the download has already been cancelled. |
| 119 virtual void CancelDownload(int32 download_id) = 0; | 121 virtual void CancelDownload(int32 download_id) = 0; |
| 120 | 122 |
| 121 // Called when there is an error in the download. | 123 // Called when there is an error in the download. |
| 122 // |download_id| is the ID of the download. | 124 // |download_id| is the ID of the download. |
| 123 // |size| is the number of bytes that are currently downloaded. | 125 // |size| is the number of bytes that are currently downloaded. |
| 126 // |hash_state| is the current state of the hash of the data that has been |
| 127 // downloaded. |
| 124 // |reason| is a download interrupt reason code. | 128 // |reason| is a download interrupt reason code. |
| 125 virtual void OnDownloadInterrupted(int32 download_id, int64 size, | 129 virtual void OnDownloadInterrupted(int32 download_id, |
| 126 InterruptReason reason) = 0; | 130 int64 size, |
| 131 std::string hash_state, |
| 132 InterruptReason reason) = 0; |
| 127 | 133 |
| 128 // Called from DownloadItem to handle the DownloadManager portion of a | 134 // Called from DownloadItem to handle the DownloadManager portion of a |
| 129 // Cancel; should not be called from other locations. | 135 // Cancel; should not be called from other locations. |
| 130 virtual void DownloadCancelledInternal(DownloadItem* download) = 0; | 136 virtual void DownloadCancelledInternal(DownloadItem* download) = 0; |
| 131 | 137 |
| 132 // Called from a view when a user clicks a UI button or link. | 138 // Called from a view when a user clicks a UI button or link. |
| 133 virtual void RemoveDownload(int64 download_handle) = 0; | 139 virtual void RemoveDownload(int64 download_handle) = 0; |
| 134 | 140 |
| 135 // Determine if the download is ready for completion, i.e. has had | 141 // Determine if the download is ready for completion, i.e. has had |
| 136 // all data saved, and completed the filename determination and | 142 // all data saved, and completed the filename determination and |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 friend class DownloadManagerTest; | 292 friend class DownloadManagerTest; |
| 287 | 293 |
| 288 friend class base::RefCountedThreadSafe< | 294 friend class base::RefCountedThreadSafe< |
| 289 DownloadManager, content::BrowserThread::DeleteOnUIThread>; | 295 DownloadManager, content::BrowserThread::DeleteOnUIThread>; |
| 290 friend struct content::BrowserThread::DeleteOnThread< | 296 friend struct content::BrowserThread::DeleteOnThread< |
| 291 content::BrowserThread::UI>; | 297 content::BrowserThread::UI>; |
| 292 friend class DeleteTask<DownloadManager>; | 298 friend class DeleteTask<DownloadManager>; |
| 293 }; | 299 }; |
| 294 | 300 |
| 295 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 301 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |