Chromium Code Reviews| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 // This state indicates that the download has been interrupted. | 72 // This state indicates that the download has been interrupted. |
| 73 INTERRUPTED, | 73 INTERRUPTED, |
| 74 | 74 |
| 75 // Maximum value. | 75 // Maximum value. |
| 76 MAX_DOWNLOAD_STATE | 76 MAX_DOWNLOAD_STATE |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 // How the final target path should be used. | 79 // How the final target path should be used. |
| 80 enum TargetDisposition { | 80 enum TargetDisposition { |
| 81 TARGET_DISPOSITION_OVERWRITE, // Overwrite if the target already exists. | 81 TARGET_DISPOSITION_OVERWRITE, // Overwrite if the target already exists. |
| 82 TARGET_DISPOSITION_PROMPT // Prompt the user for the actual | 82 TARGET_DISPOSITION_PROMPT // Prompt the user for the actual |
| 83 // target. Implies | 83 // target. Implies |
| 84 // TARGET_DISPOSITION_OVERWRITE. | 84 // TARGET_DISPOSITION_OVERWRITE. |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Callback used with AcquireFileAndDeleteDownload(). | 87 // Callback used with AcquireFileAndDeleteDownload(). |
| 88 typedef base::Callback<void(const base::FilePath&)> AcquireFileCallback; | 88 typedef base::Callback<void(const base::FilePath&)> AcquireFileCallback; |
| 89 | 89 |
| 90 // Used to represent an invalid download ID. | 90 // Used to represent an invalid download ID. |
| 91 static const uint32_t kInvalidId; | 91 static const uint32_t kInvalidId; |
| 92 | 92 |
| 93 // Interface that observers of a particular download must implement in order | 93 // Interface that observers of a particular download must implement in order |
| 94 // to receive updates to the download's status. | 94 // to receive updates to the download's status. |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 // renderer. | 428 // renderer. |
| 429 virtual WebContents* GetWebContents() const = 0; | 429 virtual WebContents* GetWebContents() const = 0; |
| 430 | 430 |
| 431 // External state transitions/setters ---------------------------------------- | 431 // External state transitions/setters ---------------------------------------- |
| 432 | 432 |
| 433 // TODO(rdsmith): These should all be removed; the download item should | 433 // TODO(rdsmith): These should all be removed; the download item should |
| 434 // control its own state transitions. | 434 // control its own state transitions. |
| 435 | 435 |
| 436 // Called if a check of the download contents was performed and the results of | 436 // Called if a check of the download contents was performed and the results of |
| 437 // the test are available. This should only be called after AllDataSaved() is | 437 // the test are available. This should only be called after AllDataSaved() is |
| 438 // true. | 438 // true. If |reason| is not DOWNLOAD_INTERRUPT_REASON_NONE, then the download |
| 439 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 439 // file should be blocked. |
|
jochen (gone - plz use gerrit)
2017/06/14 08:16:49
I find it kinda odd to pass an interrupt reason to
MAD
2017/06/14 17:50:21
Agreed. Added a TODO. Thanks!
| |
| 440 virtual void OnContentCheckCompleted(DownloadDangerType danger_type, | |
| 441 DownloadInterruptReason reason) = 0; | |
| 440 | 442 |
| 441 // Mark the download to be auto-opened when completed. | 443 // Mark the download to be auto-opened when completed. |
| 442 virtual void SetOpenWhenComplete(bool open) = 0; | 444 virtual void SetOpenWhenComplete(bool open) = 0; |
| 443 | 445 |
| 444 // Mark the download as having been opened (without actually opening it). | 446 // Mark the download as having been opened (without actually opening it). |
| 445 virtual void SetOpened(bool opened) = 0; | 447 virtual void SetOpened(bool opened) = 0; |
| 446 | 448 |
| 447 // Updates the last access time of the download. | 449 // Updates the last access time of the download. |
| 448 virtual void SetLastAccessTime(base::Time last_access_time) = 0; | 450 virtual void SetLastAccessTime(base::Time last_access_time) = 0; |
| 449 | 451 |
| 450 // Set a display name for the download that will be independent of the target | 452 // Set a display name for the download that will be independent of the target |
| 451 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 453 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
| 452 // return |name|. Has no effect on the final target filename. | 454 // return |name|. Has no effect on the final target filename. |
| 453 virtual void SetDisplayName(const base::FilePath& name) = 0; | 455 virtual void SetDisplayName(const base::FilePath& name) = 0; |
| 454 | 456 |
| 455 // Debug/testing ------------------------------------------------------------- | 457 // Debug/testing ------------------------------------------------------------- |
| 456 virtual std::string DebugString(bool verbose) const = 0; | 458 virtual std::string DebugString(bool verbose) const = 0; |
| 457 }; | 459 }; |
| 458 | 460 |
| 459 } // namespace content | 461 } // namespace content |
| 460 | 462 |
| 461 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 463 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
| OLD | NEW |