OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 virtual bool Init(BrowserContext* browser_context) = 0; | 117 virtual bool Init(BrowserContext* browser_context) = 0; |
118 | 118 |
119 // Called by a download source (Currently DownloadResourceHandler) | 119 // Called by a download source (Currently DownloadResourceHandler) |
120 // to initiate the non-source portions of a download. | 120 // to initiate the non-source portions of a download. |
121 // Returns the id assigned to the download. If the DownloadCreateInfo | 121 // Returns the id assigned to the download. If the DownloadCreateInfo |
122 // specifies an id, that id will be used. | 122 // specifies an id, that id will be used. |
123 virtual DownloadId StartDownload( | 123 virtual DownloadId StartDownload( |
124 scoped_ptr<DownloadCreateInfo> info, | 124 scoped_ptr<DownloadCreateInfo> info, |
125 scoped_ptr<ByteStreamReader> stream) = 0; | 125 scoped_ptr<ByteStreamReader> stream) = 0; |
126 | 126 |
127 // Notifications sent from the download thread to the UI thread | |
128 virtual void UpdateDownload(int32 download_id, | |
129 int64 bytes_so_far, | |
130 int64 bytes_per_sec, | |
131 const std::string& hash_state) = 0; | |
132 | |
133 // |download_id| is the ID of the download. | |
134 // |size| is the number of bytes that have been downloaded. | |
135 // |hash| is sha256 hash for the downloaded file. It is empty when the hash | |
136 // is not available. | |
137 virtual void OnResponseCompleted(int32 download_id, int64 size, | |
138 const std::string& hash) = 0; | |
139 | |
140 // Offthread target for cancelling a particular download. Will be a no-op | 127 // Offthread target for cancelling a particular download. Will be a no-op |
141 // if the download has already been cancelled. | 128 // if the download has already been cancelled. |
142 virtual void CancelDownload(int32 download_id) = 0; | 129 virtual void CancelDownload(int32 download_id) = 0; |
143 | 130 |
144 // Called when there is an error in the download. | |
145 // |download_id| is the ID of the download. | |
146 // |size| is the number of bytes that are currently downloaded. | |
147 // |hash_state| is the current state of the hash of the data that has been | |
148 // downloaded. | |
149 // |reason| is a download interrupt reason code. | |
150 virtual void OnDownloadInterrupted( | |
151 int32 download_id, | |
152 DownloadInterruptReason reason) = 0; | |
153 | |
154 // Remove downloads after remove_begin (inclusive) and before remove_end | 131 // Remove downloads after remove_begin (inclusive) and before remove_end |
155 // (exclusive). You may pass in null Time values to do an unbounded delete | 132 // (exclusive). You may pass in null Time values to do an unbounded delete |
156 // in either direction. | 133 // in either direction. |
157 virtual int RemoveDownloadsBetween(base::Time remove_begin, | 134 virtual int RemoveDownloadsBetween(base::Time remove_begin, |
158 base::Time remove_end) = 0; | 135 base::Time remove_end) = 0; |
159 | 136 |
160 // Remove downloads will delete all downloads that have a timestamp that is | 137 // Remove downloads will delete all downloads that have a timestamp that is |
161 // the same or more recent than |remove_begin|. The number of downloads | 138 // the same or more recent than |remove_begin|. The number of downloads |
162 // deleted is returned back to the caller. | 139 // deleted is returned back to the caller. |
163 virtual int RemoveDownloads(base::Time remove_begin) = 0; | 140 virtual int RemoveDownloads(base::Time remove_begin) = 0; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 protected: | 190 protected: |
214 virtual ~DownloadManager() {} | 191 virtual ~DownloadManager() {} |
215 | 192 |
216 private: | 193 private: |
217 friend class base::RefCountedThreadSafe<DownloadManager>; | 194 friend class base::RefCountedThreadSafe<DownloadManager>; |
218 }; | 195 }; |
219 | 196 |
220 } // namespace content | 197 } // namespace content |
221 | 198 |
222 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ | 199 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ |
OLD | NEW |