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