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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 virtual const std::string& GetHash() const = 0; | 229 virtual const std::string& GetHash() const = 0; |
230 | 230 |
231 // Intermediate hash state, for persisting partial downloads. | 231 // Intermediate hash state, for persisting partial downloads. |
232 virtual const std::string& GetHashState() const = 0; | 232 virtual const std::string& GetHashState() const = 0; |
233 | 233 |
234 // True if the file associated with the download has been removed by | 234 // True if the file associated with the download has been removed by |
235 // external action. | 235 // external action. |
236 virtual bool GetFileExternallyRemoved() const = 0; | 236 virtual bool GetFileExternallyRemoved() const = 0; |
237 | 237 |
238 // If the file is successfully deleted, then GetFileExternallyRemoved() will | 238 // If the file is successfully deleted, then GetFileExternallyRemoved() will |
239 // become true and DownloadItem::OnDownloadUpdated() will be called. Does | 239 // become true, GetFullPath() will become empty, and |
240 // nothing if GetState() == COMPLETE or GetFileExternallyRemoved() is already | 240 // DownloadItem::OnDownloadUpdated() will be called. Does nothing if |
241 // true. | 241 // GetState() == COMPLETE or GetFileExternallyRemoved() is already true or |
242 virtual void DeleteFile() = 0; | 242 // GetFullPath() is already empty. The callback is always run, and it is |
| 243 // always run asynchronously. It will be passed true if the file is |
| 244 // successfully deleted or if GetFilePath() was already empty or if |
| 245 // GetFileExternallyRemoved() was already true. The callback will be passed |
| 246 // false if the DownloadItem was not yet complete or if the file could not be |
| 247 // deleted for any reason. |
| 248 virtual void DeleteFile(const base::Callback<void(bool)>& callback) = 0; |
243 | 249 |
244 // True if the file that will be written by the download is dangerous | 250 // True if the file that will be written by the download is dangerous |
245 // and we will require a call to ValidateDangerousDownload() to complete. | 251 // and we will require a call to ValidateDangerousDownload() to complete. |
246 // False if the download is safe or that function has been called. | 252 // False if the download is safe or that function has been called. |
247 virtual bool IsDangerous() const = 0; | 253 virtual bool IsDangerous() const = 0; |
248 | 254 |
249 // Why |safety_state_| is not SAFE. | 255 // Why |safety_state_| is not SAFE. |
250 virtual DownloadDangerType GetDangerType() const = 0; | 256 virtual DownloadDangerType GetDangerType() const = 0; |
251 | 257 |
252 // Progress State accessors ----------------------------------------------- | 258 // Progress State accessors ----------------------------------------------- |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // return |name|. Has no effect on the final target filename. | 327 // return |name|. Has no effect on the final target filename. |
322 virtual void SetDisplayName(const base::FilePath& name) = 0; | 328 virtual void SetDisplayName(const base::FilePath& name) = 0; |
323 | 329 |
324 // Debug/testing ------------------------------------------------------------- | 330 // Debug/testing ------------------------------------------------------------- |
325 virtual std::string DebugString(bool verbose) const = 0; | 331 virtual std::string DebugString(bool verbose) const = 0; |
326 }; | 332 }; |
327 | 333 |
328 } // namespace content | 334 } // namespace content |
329 | 335 |
330 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 336 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |