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