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