| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 virtual void AddObserver(DownloadItem::Observer* observer) = 0; | 113 virtual void AddObserver(DownloadItem::Observer* observer) = 0; |
| 114 virtual void RemoveObserver(DownloadItem::Observer* observer) = 0; | 114 virtual void RemoveObserver(DownloadItem::Observer* observer) = 0; |
| 115 virtual void UpdateObservers() = 0; | 115 virtual void UpdateObservers() = 0; |
| 116 | 116 |
| 117 // User Actions -------------------------------------------------------------- | 117 // User Actions -------------------------------------------------------------- |
| 118 | 118 |
| 119 // Called when the user has validated the download of a dangerous file. | 119 // Called when the user has validated the download of a dangerous file. |
| 120 virtual void DangerousDownloadValidated() = 0; | 120 virtual void DangerousDownloadValidated() = 0; |
| 121 | 121 |
| 122 // Allow the user to temporarily pause a download or resume a paused download. | 122 // Pause a download. Will have no effect if the download is already |
| 123 virtual void TogglePause() = 0; | 123 // paused. |
| 124 virtual void Pause() = 0; |
| 125 |
| 126 // Resume a download. Will have no effect if the download is not |
| 127 // paused. |
| 128 virtual void Resume() = 0; |
| 124 | 129 |
| 125 // Cancel the download operation. We need to distinguish between cancels at | 130 // Cancel the download operation. We need to distinguish between cancels at |
| 126 // exit (DownloadManager destructor) from user interface initiated cancels | 131 // exit (DownloadManager destructor) from user interface initiated cancels |
| 127 // because at exit, the history system may not exist, and any updates to it | 132 // because at exit, the history system may not exist, and any updates to it |
| 128 // require AddRef'ing the DownloadManager in the destructor which results in | 133 // require AddRef'ing the DownloadManager in the destructor which results in |
| 129 // a DCHECK failure. Set |user_cancel| to false when canceling from at | 134 // a DCHECK failure. Set |user_cancel| to false when canceling from at |
| 130 // exit to prevent this crash. This may result in a difference between the | 135 // exit to prevent this crash. This may result in a difference between the |
| 131 // downloaded file's size on disk, and what the history system's last record | 136 // downloaded file's size on disk, and what the history system's last record |
| 132 // of it is. At worst, we'll end up re-downloading a small portion of the file | 137 // of it is. At worst, we'll end up re-downloading a small portion of the file |
| 133 // when resuming a download (assuming the server supports byte ranges). | 138 // when resuming a download (assuming the server supports byte ranges). |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 virtual void SetDisplayName(const FilePath& name) = 0; | 324 virtual void SetDisplayName(const FilePath& name) = 0; |
| 320 | 325 |
| 321 // Debug/testing ------------------------------------------------------------- | 326 // Debug/testing ------------------------------------------------------------- |
| 322 virtual std::string DebugString(bool verbose) const = 0; | 327 virtual std::string DebugString(bool verbose) const = 0; |
| 323 virtual void MockDownloadOpenForTesting() = 0; | 328 virtual void MockDownloadOpenForTesting() = 0; |
| 324 }; | 329 }; |
| 325 | 330 |
| 326 } // namespace content | 331 } // namespace content |
| 327 | 332 |
| 328 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 333 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
| OLD | NEW |