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