| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // Download is completely finished. | 57 // Download is completely finished. |
| 58 COMPLETE, | 58 COMPLETE, |
| 59 | 59 |
| 60 // Download has been cancelled. | 60 // Download has been cancelled. |
| 61 CANCELLED, | 61 CANCELLED, |
| 62 | 62 |
| 63 // This state indicates that the download has been interrupted. | 63 // This state indicates that the download has been interrupted. |
| 64 INTERRUPTED, | 64 INTERRUPTED, |
| 65 | 65 |
| 66 // The user removed this download from their history. |
| 67 REMOVED, |
| 68 |
| 66 // Maximum value. | 69 // Maximum value. |
| 67 MAX_DOWNLOAD_STATE | 70 MAX_DOWNLOAD_STATE |
| 68 }; | 71 }; |
| 69 | 72 |
| 70 // How the final target path should be used. | 73 // How the final target path should be used. |
| 71 enum TargetDisposition { | 74 enum TargetDisposition { |
| 72 TARGET_DISPOSITION_OVERWRITE, // Overwrite if the target already exists. | 75 TARGET_DISPOSITION_OVERWRITE, // Overwrite if the target already exists. |
| 73 TARGET_DISPOSITION_PROMPT // Prompt the user for the actual | 76 TARGET_DISPOSITION_PROMPT // Prompt the user for the actual |
| 74 // target. Implies | 77 // target. Implies |
| 75 // TARGET_DISPOSITION_OVERWRITE. | 78 // TARGET_DISPOSITION_OVERWRITE. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // exit (DownloadManager destructor) from user interface initiated cancels | 134 // exit (DownloadManager destructor) from user interface initiated cancels |
| 132 // because at exit, the history system may not exist, and any updates to it | 135 // because at exit, the history system may not exist, and any updates to it |
| 133 // require AddRef'ing the DownloadManager in the destructor which results in | 136 // require AddRef'ing the DownloadManager in the destructor which results in |
| 134 // a DCHECK failure. Set |user_cancel| to false when canceling from at | 137 // a DCHECK failure. Set |user_cancel| to false when canceling from at |
| 135 // exit to prevent this crash. This may result in a difference between the | 138 // exit to prevent this crash. This may result in a difference between the |
| 136 // downloaded file's size on disk, and what the history system's last record | 139 // downloaded file's size on disk, and what the history system's last record |
| 137 // of it is. At worst, we'll end up re-downloading a small portion of the file | 140 // of it is. At worst, we'll end up re-downloading a small portion of the file |
| 138 // when resuming a download (assuming the server supports byte ranges). | 141 // when resuming a download (assuming the server supports byte ranges). |
| 139 virtual void Cancel(bool user_cancel) = 0; | 142 virtual void Cancel(bool user_cancel) = 0; |
| 140 | 143 |
| 144 // Marks the download as removed but doesn't actually delete it yet. This |
| 145 // behavior is used from chrome://downloads so removal can be undone. |
| 146 virtual void MarkRemoved() = 0; |
| 147 |
| 148 // Undoes the effects of MarkRemoved() and restores the download's |status_| |
| 149 // to |prev_status_|. Used from chrome://downloads so removal can be undone. |
| 150 virtual void UndoRemove() = 0; |
| 151 |
| 141 // Removes the download from the views and history. If the download was | 152 // Removes the download from the views and history. If the download was |
| 142 // in-progress or interrupted, then the intermediate file will also be | 153 // in-progress or interrupted, then the intermediate file will also be |
| 143 // deleted. | 154 // deleted. |
| 144 virtual void Remove() = 0; | 155 virtual void Remove() = 0; |
| 145 | 156 |
| 146 // Open the file associated with this download. If the download is | 157 // Open the file associated with this download. If the download is |
| 147 // still in progress, marks the download to be opened when it is complete. | 158 // still in progress, marks the download to be opened when it is complete. |
| 148 virtual void OpenDownload() = 0; | 159 virtual void OpenDownload() = 0; |
| 149 | 160 |
| 150 // Show the download via the OS shell. | 161 // Show the download via the OS shell. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // return |name|. Has no effect on the final target filename. | 340 // return |name|. Has no effect on the final target filename. |
| 330 virtual void SetDisplayName(const base::FilePath& name) = 0; | 341 virtual void SetDisplayName(const base::FilePath& name) = 0; |
| 331 | 342 |
| 332 // Debug/testing ------------------------------------------------------------- | 343 // Debug/testing ------------------------------------------------------------- |
| 333 virtual std::string DebugString(bool verbose) const = 0; | 344 virtual std::string DebugString(bool verbose) const = 0; |
| 334 }; | 345 }; |
| 335 | 346 |
| 336 } // namespace content | 347 } // namespace content |
| 337 | 348 |
| 338 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 349 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
| OLD | NEW |