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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 virtual void AddObserver(DownloadItem::Observer* observer) = 0; | 109 virtual void AddObserver(DownloadItem::Observer* observer) = 0; |
110 virtual void RemoveObserver(DownloadItem::Observer* observer) = 0; | 110 virtual void RemoveObserver(DownloadItem::Observer* observer) = 0; |
111 virtual void UpdateObservers() = 0; | 111 virtual void UpdateObservers() = 0; |
112 | 112 |
113 // User Actions -------------------------------------------------------------- | 113 // User Actions -------------------------------------------------------------- |
114 | 114 |
115 // Called when the user has validated the download of a dangerous file. | 115 // Called when the user has validated the download of a dangerous file. |
116 virtual void ValidateDangerousDownload() = 0; | 116 virtual void ValidateDangerousDownload() = 0; |
117 | 117 |
118 // Called to acquire a dangerous download and remove the DownloadItem from | 118 // Called to acquire a dangerous download. If |delete_file_afterward| is true, |
119 // views and history. |callback| will be invoked on the UI thread with the | 119 // invokes |callback| on the UI thread with the path to the downloaded file, |
120 // path to the downloaded file. The caller is responsible for cleanup. | 120 // and removes the DownloadItem from views and history if appropriate. |
| 121 // Otherwise, makes a temp copy of the download file, and invokes |callback| |
| 122 // with the path to the temp copy. The caller is responsible for cleanup. |
121 // Note: It is important for |callback| to be valid since the downloaded file | 123 // Note: It is important for |callback| to be valid since the downloaded file |
122 // will not be cleaned up if the callback fails. | 124 // will not be cleaned up if the callback fails. |
123 virtual void StealDangerousDownload(const AcquireFileCallback& callback) = 0; | 125 virtual void StealDangerousDownload(bool delete_file_afterward, |
| 126 const AcquireFileCallback& callback) = 0; |
124 | 127 |
125 // Pause a download. Will have no effect if the download is already | 128 // Pause a download. Will have no effect if the download is already |
126 // paused. | 129 // paused. |
127 virtual void Pause() = 0; | 130 virtual void Pause() = 0; |
128 | 131 |
129 // Resume a download that has been paused or interrupted. Will have no effect | 132 // Resume a download that has been paused or interrupted. Will have no effect |
130 // if the download is neither. Only does something if CanResume() returns | 133 // if the download is neither. Only does something if CanResume() returns |
131 // true. | 134 // true. |
132 virtual void Resume() = 0; | 135 virtual void Resume() = 0; |
133 | 136 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // return |name|. Has no effect on the final target filename. | 408 // return |name|. Has no effect on the final target filename. |
406 virtual void SetDisplayName(const base::FilePath& name) = 0; | 409 virtual void SetDisplayName(const base::FilePath& name) = 0; |
407 | 410 |
408 // Debug/testing ------------------------------------------------------------- | 411 // Debug/testing ------------------------------------------------------------- |
409 virtual std::string DebugString(bool verbose) const = 0; | 412 virtual std::string DebugString(bool verbose) const = 0; |
410 }; | 413 }; |
411 | 414 |
412 } // namespace content | 415 } // namespace content |
413 | 416 |
414 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 417 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |