| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 static const char kEmptyFileHash[]; | 83 static const char kEmptyFileHash[]; |
| 84 | 84 |
| 85 // Interface that observers of a particular download must implement in order | 85 // Interface that observers of a particular download must implement in order |
| 86 // to receive updates to the download's status. | 86 // to receive updates to the download's status. |
| 87 class CONTENT_EXPORT Observer { | 87 class CONTENT_EXPORT Observer { |
| 88 public: | 88 public: |
| 89 virtual void OnDownloadUpdated(DownloadItem* download) {} | 89 virtual void OnDownloadUpdated(DownloadItem* download) {} |
| 90 virtual void OnDownloadOpened(DownloadItem* download) {} | 90 virtual void OnDownloadOpened(DownloadItem* download) {} |
| 91 virtual void OnDownloadRemoved(DownloadItem* download) {} | 91 virtual void OnDownloadRemoved(DownloadItem* download) {} |
| 92 virtual void OnDownloadShown(DownloadItem* download) {} |
| 92 | 93 |
| 93 // Called when the download is being destroyed. This happens after | 94 // Called when the download is being destroyed. This happens after |
| 94 // every OnDownloadRemoved() as well as when the DownloadManager is going | 95 // every OnDownloadRemoved() as well as when the DownloadManager is going |
| 95 // down. | 96 // down. |
| 96 virtual void OnDownloadDestroyed(DownloadItem* download) {} | 97 virtual void OnDownloadDestroyed(DownloadItem* download) {} |
| 97 | 98 |
| 98 protected: | 99 protected: |
| 99 virtual ~Observer() {} | 100 virtual ~Observer() {} |
| 100 }; | 101 }; |
| 101 | 102 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // true. | 315 // true. |
| 315 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 316 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; |
| 316 | 317 |
| 317 // Mark the download to be auto-opened when completed. | 318 // Mark the download to be auto-opened when completed. |
| 318 virtual void SetOpenWhenComplete(bool open) = 0; | 319 virtual void SetOpenWhenComplete(bool open) = 0; |
| 319 | 320 |
| 320 // Mark the download as temporary (not visible in persisted store or | 321 // Mark the download as temporary (not visible in persisted store or |
| 321 // SearchDownloads(), removed from main UI upon completion). | 322 // SearchDownloads(), removed from main UI upon completion). |
| 322 virtual void SetIsTemporary(bool temporary) = 0; | 323 virtual void SetIsTemporary(bool temporary) = 0; |
| 323 | 324 |
| 324 // Mark the download as having been opened (without actually opening it). | |
| 325 virtual void SetOpened(bool opened) = 0; | |
| 326 | |
| 327 // Set a display name for the download that will be independent of the target | 325 // Set a display name for the download that will be independent of the target |
| 328 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 326 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
| 329 // return |name|. Has no effect on the final target filename. | 327 // return |name|. Has no effect on the final target filename. |
| 330 virtual void SetDisplayName(const base::FilePath& name) = 0; | 328 virtual void SetDisplayName(const base::FilePath& name) = 0; |
| 331 | 329 |
| 332 // Debug/testing ------------------------------------------------------------- | 330 // Debug/testing ------------------------------------------------------------- |
| 333 virtual std::string DebugString(bool verbose) const = 0; | 331 virtual std::string DebugString(bool verbose) const = 0; |
| 334 }; | 332 }; |
| 335 | 333 |
| 336 } // namespace content | 334 } // namespace content |
| 337 | 335 |
| 338 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 336 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
| OLD | NEW |