| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Used to represent an invalid download ID. | 85 // Used to represent an invalid download ID. |
| 86 static const uint32_t kInvalidId; | 86 static const uint32_t kInvalidId; |
| 87 | 87 |
| 88 // Interface that observers of a particular download must implement in order | 88 // Interface that observers of a particular download must implement in order |
| 89 // to receive updates to the download's status. | 89 // to receive updates to the download's status. |
| 90 class CONTENT_EXPORT Observer { | 90 class CONTENT_EXPORT Observer { |
| 91 public: | 91 public: |
| 92 virtual void OnDownloadUpdated(DownloadItem* download) {} | 92 virtual void OnDownloadUpdated(DownloadItem* download) {} |
| 93 virtual void OnDownloadOpened(DownloadItem* download) {} | 93 virtual void OnDownloadOpened(DownloadItem* download) {} |
| 94 virtual void OnDownloadShown(DownloadItem* download) {} |
| 94 virtual void OnDownloadRemoved(DownloadItem* download) {} | 95 virtual void OnDownloadRemoved(DownloadItem* download) {} |
| 95 | 96 |
| 96 // Called when the download is being destroyed. This happens after | 97 // Called when the download is being destroyed. This happens after |
| 97 // every OnDownloadRemoved() as well as when the DownloadManager is going | 98 // every OnDownloadRemoved() as well as when the DownloadManager is going |
| 98 // down. | 99 // down. |
| 99 virtual void OnDownloadDestroyed(DownloadItem* download) {} | 100 virtual void OnDownloadDestroyed(DownloadItem* download) {} |
| 100 | 101 |
| 101 protected: | 102 protected: |
| 102 virtual ~Observer() {} | 103 virtual ~Observer() {} |
| 103 }; | 104 }; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // control its own state transitions. | 391 // control its own state transitions. |
| 391 | 392 |
| 392 // Called if a check of the download contents was performed and the results of | 393 // Called if a check of the download contents was performed and the results of |
| 393 // the test are available. This should only be called after AllDataSaved() is | 394 // the test are available. This should only be called after AllDataSaved() is |
| 394 // true. | 395 // true. |
| 395 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 396 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; |
| 396 | 397 |
| 397 // Mark the download to be auto-opened when completed. | 398 // Mark the download to be auto-opened when completed. |
| 398 virtual void SetOpenWhenComplete(bool open) = 0; | 399 virtual void SetOpenWhenComplete(bool open) = 0; |
| 399 | 400 |
| 400 // Mark the download as having been opened (without actually opening it). | |
| 401 virtual void SetOpened(bool opened) = 0; | |
| 402 | |
| 403 // Set a display name for the download that will be independent of the target | 401 // Set a display name for the download that will be independent of the target |
| 404 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 402 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
| 405 // return |name|. Has no effect on the final target filename. | 403 // return |name|. Has no effect on the final target filename. |
| 406 virtual void SetDisplayName(const base::FilePath& name) = 0; | 404 virtual void SetDisplayName(const base::FilePath& name) = 0; |
| 407 | 405 |
| 408 // Debug/testing ------------------------------------------------------------- | 406 // Debug/testing ------------------------------------------------------------- |
| 409 virtual std::string DebugString(bool verbose) const = 0; | 407 virtual std::string DebugString(bool verbose) const = 0; |
| 410 }; | 408 }; |
| 411 | 409 |
| 412 } // namespace content | 410 } // namespace content |
| 413 | 411 |
| 414 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 412 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
| OLD | NEW |