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 // Each download is represented by a DownloadItem, and all DownloadItems | 5 // Each download is represented by a DownloadItem, and all DownloadItems |
6 // are owned by the DownloadManager which maintains a global list of all | 6 // are owned by the DownloadManager which maintains a global list of all |
7 // downloads. DownloadItems are created when a user initiates a download, | 7 // downloads. DownloadItems are created when a user initiates a download, |
8 // and exist for the duration of the browser life time. | 8 // and exist for the duration of the browser life time. |
9 // | 9 // |
10 // Download observers: | 10 // Download observers: |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // State accessors ----------------------------------------------------------- | 154 // State accessors ----------------------------------------------------------- |
155 | 155 |
156 virtual int32 GetId() const = 0; | 156 virtual int32 GetId() const = 0; |
157 virtual DownloadId GetGlobalId() const = 0; | 157 virtual DownloadId GetGlobalId() const = 0; |
158 virtual DownloadState GetState() const = 0; | 158 virtual DownloadState GetState() const = 0; |
159 | 159 |
160 // Only valid if |GetState() == DownloadItem::INTERRUPTED|. | 160 // Only valid if |GetState() == DownloadItem::INTERRUPTED|. |
161 virtual DownloadInterruptReason GetLastReason() const = 0; | 161 virtual DownloadInterruptReason GetLastReason() const = 0; |
162 | 162 |
163 virtual bool IsPaused() const = 0; | 163 virtual bool IsPaused() const = 0; |
| 164 virtual bool CanResumeInterrupted() const = 0; |
164 virtual bool IsTemporary() const = 0; | 165 virtual bool IsTemporary() const = 0; |
165 | 166 |
166 // Convenience routines for accessing GetState() results conceptually ----- | 167 // Convenience routines for accessing GetState() results conceptually ----- |
167 | 168 |
168 // Returns true if the download needs more data. | 169 // Returns true if the download needs more data. |
169 virtual bool IsPartialDownload() const = 0; | 170 virtual bool IsPartialDownload() const = 0; |
170 | 171 |
171 // Returns true if the download is still receiving data. | 172 // Returns true if the download is still receiving data. |
172 virtual bool IsInProgress() const = 0; | 173 virtual bool IsInProgress() const = 0; |
173 | 174 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 virtual base::Time GetEndTime() const = 0; | 275 virtual base::Time GetEndTime() const = 0; |
275 | 276 |
276 // Open/Show State accessors ---------------------------------------------- | 277 // Open/Show State accessors ---------------------------------------------- |
277 | 278 |
278 // Returns true if it is OK to open a folder which this file is inside. | 279 // Returns true if it is OK to open a folder which this file is inside. |
279 virtual bool CanShowInFolder() = 0; | 280 virtual bool CanShowInFolder() = 0; |
280 | 281 |
281 // Returns true if it is OK to open the download. | 282 // Returns true if it is OK to open the download. |
282 virtual bool CanOpenDownload() = 0; | 283 virtual bool CanOpenDownload() = 0; |
283 | 284 |
| 285 // Returns true if the download is paused or interrupted, and can be resumed. |
| 286 virtual bool CanResumeDownload() const = 0; |
| 287 |
284 // Tests if a file type should be opened automatically. | 288 // Tests if a file type should be opened automatically. |
285 virtual bool ShouldOpenFileBasedOnExtension() = 0; | 289 virtual bool ShouldOpenFileBasedOnExtension() = 0; |
286 | 290 |
287 // Returns true if the download will be auto-opened when complete. | 291 // Returns true if the download will be auto-opened when complete. |
288 virtual bool GetOpenWhenComplete() const = 0; | 292 virtual bool GetOpenWhenComplete() const = 0; |
289 | 293 |
290 // Returns true if the download has been auto-opened by the system. | 294 // Returns true if the download has been auto-opened by the system. |
291 virtual bool GetAutoOpened() = 0; | 295 virtual bool GetAutoOpened() = 0; |
292 | 296 |
293 // Returns true if the download has been opened. | 297 // Returns true if the download has been opened. |
(...skipping 29 matching lines...) Expand all Loading... |
323 virtual void SetDisplayName(const FilePath& name) = 0; | 327 virtual void SetDisplayName(const FilePath& name) = 0; |
324 | 328 |
325 // Debug/testing ------------------------------------------------------------- | 329 // Debug/testing ------------------------------------------------------------- |
326 virtual std::string DebugString(bool verbose) const = 0; | 330 virtual std::string DebugString(bool verbose) const = 0; |
327 virtual void MockDownloadOpenForTesting() = 0; | 331 virtual void MockDownloadOpenForTesting() = 0; |
328 }; | 332 }; |
329 | 333 |
330 } // namespace content | 334 } // namespace content |
331 | 335 |
332 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 336 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |