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 // |callback| will be invoked on the UI thread with the path to the downloaded |
120 // path to the downloaded file. The caller is responsible for cleanup. | 120 // file, and the DownloadItem will be removed from views and history if |
121 // appropriate. Otherwise, make a temp copy of the download file, and invoke | |
122 // |callback| with the path to the temp copy. The caller is responsible for | |
123 // cleanup. | |
asanka
2016/11/07 16:01:55
Nit: I suggest changing 'X will be <verb>d' to '<v
Jialiu Lin
2016/11/14 20:57:39
Done.
| |
121 // Note: It is important for |callback| to be valid since the downloaded file | 124 // Note: It is important for |callback| to be valid since the downloaded file |
122 // will not be cleaned up if the callback fails. | 125 // will not be cleaned up if the callback fails. |
123 virtual void StealDangerousDownload(const AcquireFileCallback& callback) = 0; | 126 virtual void StealDangerousDownload(bool delete_file_afterward, |
127 const AcquireFileCallback& callback) = 0; | |
124 | 128 |
125 // Pause a download. Will have no effect if the download is already | 129 // Pause a download. Will have no effect if the download is already |
126 // paused. | 130 // paused. |
127 virtual void Pause() = 0; | 131 virtual void Pause() = 0; |
128 | 132 |
129 // Resume a download that has been paused or interrupted. Will have no effect | 133 // 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 | 134 // if the download is neither. Only does something if CanResume() returns |
131 // true. | 135 // true. |
132 virtual void Resume() = 0; | 136 virtual void Resume() = 0; |
133 | 137 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 // return |name|. Has no effect on the final target filename. | 409 // return |name|. Has no effect on the final target filename. |
406 virtual void SetDisplayName(const base::FilePath& name) = 0; | 410 virtual void SetDisplayName(const base::FilePath& name) = 0; |
407 | 411 |
408 // Debug/testing ------------------------------------------------------------- | 412 // Debug/testing ------------------------------------------------------------- |
409 virtual std::string DebugString(bool verbose) const = 0; | 413 virtual std::string DebugString(bool verbose) const = 0; |
410 }; | 414 }; |
411 | 415 |
412 } // namespace content | 416 } // namespace content |
413 | 417 |
414 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 418 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |