| 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 bytes_so_far, | 108 virtual void UpdateDownload(int32 download_id, |
| 109 int64 bytes_per_sec) = 0; | 109 int64 bytes_so_far, |
| 110 int64 bytes_per_sec, |
| 111 std::string hash_state) = 0; |
| 110 | 112 |
| 111 // |download_id| is the ID of the download. | 113 // |download_id| is the ID of the download. |
| 112 // |size| is the number of bytes that have been downloaded. | 114 // |size| is the number of bytes that have been downloaded. |
| 113 // |hash| is sha256 hash for the downloaded file. It is empty when the hash | 115 // |hash| is sha256 hash for the downloaded file. It is empty when the hash |
| 114 // is not available. | 116 // is not available. |
| 115 virtual void OnResponseCompleted(int32 download_id, int64 size, | 117 virtual void OnResponseCompleted(int32 download_id, int64 size, |
| 116 const std::string& hash) = 0; | 118 const std::string& hash) = 0; |
| 117 | 119 |
| 118 // Offthread target for cancelling a particular download. Will be a no-op | 120 // Offthread target for cancelling a particular download. Will be a no-op |
| 119 // if the download has already been cancelled. | 121 // if the download has already been cancelled. |
| 120 virtual void CancelDownload(int32 download_id) = 0; | 122 virtual void CancelDownload(int32 download_id) = 0; |
| 121 | 123 |
| 122 // Called when there is an error in the download. | 124 // Called when there is an error in the download. |
| 123 // |download_id| is the ID of the download. | 125 // |download_id| is the ID of the download. |
| 124 // |size| is the number of bytes that are currently downloaded. | 126 // |size| is the number of bytes that are currently downloaded. |
| 127 // |hash_state| is the current state of the hash of the data that has been |
| 128 // downloaded. |
| 125 // |reason| is a download interrupt reason code. | 129 // |reason| is a download interrupt reason code. |
| 126 virtual void OnDownloadInterrupted(int32 download_id, int64 size, | 130 virtual void OnDownloadInterrupted(int32 download_id, |
| 131 int64 size, |
| 132 std::string hash_state, |
| 127 InterruptReason reason) = 0; | 133 InterruptReason reason) = 0; |
| 128 | 134 |
| 129 // Called when the download is renamed to its final name. | 135 // Called when the download is renamed to its final name. |
| 130 // |uniquifier| is a number used to make unique names for the file. It is | 136 // |uniquifier| is a number used to make unique names for the file. It is |
| 131 // only valid for the DANGEROUS_BUT_VALIDATED state of the download item. | 137 // only valid for the DANGEROUS_BUT_VALIDATED state of the download item. |
| 132 virtual void OnDownloadRenamedToFinalName(int download_id, | 138 virtual void OnDownloadRenamedToFinalName(int download_id, |
| 133 const FilePath& full_path, | 139 const FilePath& full_path, |
| 134 int uniquifier) = 0; | 140 int uniquifier) = 0; |
| 135 | 141 |
| 136 // Remove downloads after remove_begin (inclusive) and before remove_end | 142 // Remove downloads after remove_begin (inclusive) and before remove_end |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 friend class base::RefCountedThreadSafe< | 262 friend class base::RefCountedThreadSafe< |
| 257 DownloadManager, content::BrowserThread::DeleteOnUIThread>; | 263 DownloadManager, content::BrowserThread::DeleteOnUIThread>; |
| 258 friend struct content::BrowserThread::DeleteOnThread< | 264 friend struct content::BrowserThread::DeleteOnThread< |
| 259 content::BrowserThread::UI>; | 265 content::BrowserThread::UI>; |
| 260 friend class DeleteTask<DownloadManager>; | 266 friend class DeleteTask<DownloadManager>; |
| 261 }; | 267 }; |
| 262 | 268 |
| 263 } // namespace content | 269 } // namespace content |
| 264 | 270 |
| 265 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 271 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
| OLD | NEW |