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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 // Returns true if the download will be auto-opened when complete. | 390 // Returns true if the download will be auto-opened when complete. |
391 virtual bool GetOpenWhenComplete() const = 0; | 391 virtual bool GetOpenWhenComplete() const = 0; |
392 | 392 |
393 // Returns true if the download has been auto-opened by the system. | 393 // Returns true if the download has been auto-opened by the system. |
394 virtual bool GetAutoOpened() = 0; | 394 virtual bool GetAutoOpened() = 0; |
395 | 395 |
396 // Returns true if the download has been opened. | 396 // Returns true if the download has been opened. |
397 virtual bool GetOpened() const = 0; | 397 virtual bool GetOpened() const = 0; |
398 | 398 |
| 399 // Time the download was last accessed. Returns NULL if the download has never |
| 400 // been opened. |
| 401 virtual base::Time GetLastAccessTime() const = 0; |
| 402 |
399 // Misc State accessors --------------------------------------------------- | 403 // Misc State accessors --------------------------------------------------- |
400 | 404 |
401 // BrowserContext that indirectly owns this download. Always valid. | 405 // BrowserContext that indirectly owns this download. Always valid. |
402 virtual BrowserContext* GetBrowserContext() const = 0; | 406 virtual BrowserContext* GetBrowserContext() const = 0; |
403 | 407 |
404 // WebContents associated with the download. Returns nullptr if the | 408 // WebContents associated with the download. Returns nullptr if the |
405 // WebContents is unknown or if the download was not performed on behalf of a | 409 // WebContents is unknown or if the download was not performed on behalf of a |
406 // renderer. | 410 // renderer. |
407 virtual WebContents* GetWebContents() const = 0; | 411 virtual WebContents* GetWebContents() const = 0; |
408 | 412 |
409 // External state transitions/setters ---------------------------------------- | 413 // External state transitions/setters ---------------------------------------- |
410 | 414 |
411 // TODO(rdsmith): These should all be removed; the download item should | 415 // TODO(rdsmith): These should all be removed; the download item should |
412 // control its own state transitions. | 416 // control its own state transitions. |
413 | 417 |
414 // Called if a check of the download contents was performed and the results of | 418 // Called if a check of the download contents was performed and the results of |
415 // the test are available. This should only be called after AllDataSaved() is | 419 // the test are available. This should only be called after AllDataSaved() is |
416 // true. | 420 // true. |
417 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 421 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; |
418 | 422 |
419 // Mark the download to be auto-opened when completed. | 423 // Mark the download to be auto-opened when completed. |
420 virtual void SetOpenWhenComplete(bool open) = 0; | 424 virtual void SetOpenWhenComplete(bool open) = 0; |
421 | 425 |
422 // Mark the download as having been opened (without actually opening it). | 426 // Mark the download as having been opened (without actually opening it). |
423 virtual void SetOpened(bool opened) = 0; | 427 virtual void SetOpened(bool opened) = 0; |
424 | 428 |
| 429 // Updates the last access time of the download. |
| 430 virtual void SetLastAccessTime(base::Time last_access_time) = 0; |
| 431 |
425 // Set a display name for the download that will be independent of the target | 432 // Set a display name for the download that will be independent of the target |
426 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 433 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
427 // return |name|. Has no effect on the final target filename. | 434 // return |name|. Has no effect on the final target filename. |
428 virtual void SetDisplayName(const base::FilePath& name) = 0; | 435 virtual void SetDisplayName(const base::FilePath& name) = 0; |
429 | 436 |
430 // Debug/testing ------------------------------------------------------------- | 437 // Debug/testing ------------------------------------------------------------- |
431 virtual std::string DebugString(bool verbose) const = 0; | 438 virtual std::string DebugString(bool verbose) const = 0; |
432 }; | 439 }; |
433 | 440 |
434 } // namespace content | 441 } // namespace content |
435 | 442 |
436 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 443 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |