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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 | 370 |
371 // Returns true if the download will be auto-opened when complete. | 371 // Returns true if the download will be auto-opened when complete. |
372 virtual bool GetOpenWhenComplete() const = 0; | 372 virtual bool GetOpenWhenComplete() const = 0; |
373 | 373 |
374 // Returns true if the download has been auto-opened by the system. | 374 // Returns true if the download has been auto-opened by the system. |
375 virtual bool GetAutoOpened() = 0; | 375 virtual bool GetAutoOpened() = 0; |
376 | 376 |
377 // Returns true if the download has been opened. | 377 // Returns true if the download has been opened. |
378 virtual bool GetOpened() const = 0; | 378 virtual bool GetOpened() const = 0; |
379 | 379 |
380 // Time the download was last accessed. Returns NULL if the download has never | |
381 // been opened. | |
382 virtual base::Time GetLastAccessTime() const = 0; | |
383 | |
380 // Misc State accessors --------------------------------------------------- | 384 // Misc State accessors --------------------------------------------------- |
381 | 385 |
382 // BrowserContext that indirectly owns this download. Always valid. | 386 // BrowserContext that indirectly owns this download. Always valid. |
383 virtual BrowserContext* GetBrowserContext() const = 0; | 387 virtual BrowserContext* GetBrowserContext() const = 0; |
384 | 388 |
385 // WebContents associated with the download. Returns nullptr if the | 389 // WebContents associated with the download. Returns nullptr if the |
386 // WebContents is unknown or if the download was not performed on behalf of a | 390 // WebContents is unknown or if the download was not performed on behalf of a |
387 // renderer. | 391 // renderer. |
388 virtual WebContents* GetWebContents() const = 0; | 392 virtual WebContents* GetWebContents() const = 0; |
389 | 393 |
390 // External state transitions/setters ---------------------------------------- | 394 // External state transitions/setters ---------------------------------------- |
391 | 395 |
392 // TODO(rdsmith): These should all be removed; the download item should | 396 // TODO(rdsmith): These should all be removed; the download item should |
393 // control its own state transitions. | 397 // control its own state transitions. |
394 | 398 |
395 // Called if a check of the download contents was performed and the results of | 399 // Called if a check of the download contents was performed and the results of |
396 // the test are available. This should only be called after AllDataSaved() is | 400 // the test are available. This should only be called after AllDataSaved() is |
397 // true. | 401 // true. |
398 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; | 402 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; |
399 | 403 |
400 // Mark the download to be auto-opened when completed. | 404 // Mark the download to be auto-opened when completed. |
401 virtual void SetOpenWhenComplete(bool open) = 0; | 405 virtual void SetOpenWhenComplete(bool open) = 0; |
402 | 406 |
403 // Mark the download as having been opened (without actually opening it). | 407 // Mark the download as having been opened (without actually opening it). |
404 virtual void SetOpened(bool opened) = 0; | 408 virtual void SetOpened(bool opened) = 0; |
405 | 409 |
410 // Updates the last access time of the download. | |
411 virtual void UpdateLastAccessTime() = 0; | |
David Trainor- moved to gerrit
2017/02/22 05:56:03
Should this just be SetLastAccessTime(Time)? That
shaktisahu
2017/02/23 06:55:50
Good idea. Done.
| |
412 | |
406 // Set a display name for the download that will be independent of the target | 413 // Set a display name for the download that will be independent of the target |
407 // filename. If |name| is not empty, then GetFileNameToReportUser() will | 414 // filename. If |name| is not empty, then GetFileNameToReportUser() will |
408 // return |name|. Has no effect on the final target filename. | 415 // return |name|. Has no effect on the final target filename. |
409 virtual void SetDisplayName(const base::FilePath& name) = 0; | 416 virtual void SetDisplayName(const base::FilePath& name) = 0; |
410 | 417 |
411 // Debug/testing ------------------------------------------------------------- | 418 // Debug/testing ------------------------------------------------------------- |
412 virtual std::string DebugString(bool verbose) const = 0; | 419 virtual std::string DebugString(bool verbose) const = 0; |
413 }; | 420 }; |
414 | 421 |
415 } // namespace content | 422 } // namespace content |
416 | 423 |
417 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ | 424 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ |
OLD | NEW |