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 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 const base::Time& end_time, | 68 const base::Time& end_time, |
69 const std::string& etag, | 69 const std::string& etag, |
70 const std::string& last_modified, | 70 const std::string& last_modified, |
71 int64_t received_bytes, | 71 int64_t received_bytes, |
72 int64_t total_bytes, | 72 int64_t total_bytes, |
73 const std::string& hash, | 73 const std::string& hash, |
74 DownloadItem::DownloadState state, | 74 DownloadItem::DownloadState state, |
75 DownloadDangerType danger_type, | 75 DownloadDangerType danger_type, |
76 DownloadInterruptReason interrupt_reason, | 76 DownloadInterruptReason interrupt_reason, |
77 bool opened, | 77 bool opened, |
| 78 const base::Time& last_access_time, |
78 const std::vector<DownloadItem::ReceivedSlice>& received_slices, | 79 const std::vector<DownloadItem::ReceivedSlice>& received_slices, |
79 const net::NetLogWithSource& net_log); | 80 const net::NetLogWithSource& net_log); |
80 | 81 |
81 // Constructing for a regular download. | 82 // Constructing for a regular download. |
82 // |net_log| is constructed externally for our use. | 83 // |net_log| is constructed externally for our use. |
83 DownloadItemImpl(DownloadItemImplDelegate* delegate, | 84 DownloadItemImpl(DownloadItemImplDelegate* delegate, |
84 uint32_t id, | 85 uint32_t id, |
85 const DownloadCreateInfo& info, | 86 const DownloadCreateInfo& info, |
86 const net::NetLogWithSource& net_log); | 87 const net::NetLogWithSource& net_log); |
87 | 88 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const std::vector<DownloadItem::ReceivedSlice>& GetReceivedSlices() | 156 const std::vector<DownloadItem::ReceivedSlice>& GetReceivedSlices() |
156 const override; | 157 const override; |
157 base::Time GetStartTime() const override; | 158 base::Time GetStartTime() const override; |
158 base::Time GetEndTime() const override; | 159 base::Time GetEndTime() const override; |
159 bool CanShowInFolder() override; | 160 bool CanShowInFolder() override; |
160 bool CanOpenDownload() override; | 161 bool CanOpenDownload() override; |
161 bool ShouldOpenFileBasedOnExtension() override; | 162 bool ShouldOpenFileBasedOnExtension() override; |
162 bool GetOpenWhenComplete() const override; | 163 bool GetOpenWhenComplete() const override; |
163 bool GetAutoOpened() override; | 164 bool GetAutoOpened() override; |
164 bool GetOpened() const override; | 165 bool GetOpened() const override; |
| 166 base::Time GetLastAccessTime() const override; |
165 BrowserContext* GetBrowserContext() const override; | 167 BrowserContext* GetBrowserContext() const override; |
166 WebContents* GetWebContents() const override; | 168 WebContents* GetWebContents() const override; |
167 void OnContentCheckCompleted(DownloadDangerType danger_type) override; | 169 void OnContentCheckCompleted(DownloadDangerType danger_type) override; |
168 void SetOpenWhenComplete(bool open) override; | 170 void SetOpenWhenComplete(bool open) override; |
169 void SetOpened(bool opened) override; | 171 void SetOpened(bool opened) override; |
| 172 void SetLastAccessTime(const base::Time& last_access_time) override; |
170 void SetDisplayName(const base::FilePath& name) override; | 173 void SetDisplayName(const base::FilePath& name) override; |
171 std::string DebugString(bool verbose) const override; | 174 std::string DebugString(bool verbose) const override; |
172 | 175 |
173 // All remaining public interfaces virtual to allow for DownloadItemImpl | 176 // All remaining public interfaces virtual to allow for DownloadItemImpl |
174 // mocks. | 177 // mocks. |
175 | 178 |
176 // Determines the resume mode for an interrupted download. Requires | 179 // Determines the resume mode for an interrupted download. Requires |
177 // last_reason_ to be set, but doesn't require the download to be in | 180 // last_reason_ to be set, but doesn't require the download to be in |
178 // INTERRUPTED state. | 181 // INTERRUPTED state. |
179 virtual ResumeMode GetResumeMode() const; | 182 virtual ResumeMode GetResumeMode() const; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 617 |
615 // True if the item was downloaded temporarily. | 618 // True if the item was downloaded temporarily. |
616 bool is_temporary_ = false; | 619 bool is_temporary_ = false; |
617 | 620 |
618 // Did the user open the item either directly or indirectly (such as by | 621 // Did the user open the item either directly or indirectly (such as by |
619 // setting always open files of this type)? The shelf also sets this field | 622 // setting always open files of this type)? The shelf also sets this field |
620 // when the user closes the shelf before the item has been opened but should | 623 // when the user closes the shelf before the item has been opened but should |
621 // be treated as though the user opened it. | 624 // be treated as though the user opened it. |
622 bool opened_ = false; | 625 bool opened_ = false; |
623 | 626 |
| 627 // Time when the download was last accessed. |
| 628 base::Time last_access_time_; |
| 629 |
624 // Did the delegate delay calling Complete on this download? | 630 // Did the delegate delay calling Complete on this download? |
625 bool delegate_delayed_complete_ = false; | 631 bool delegate_delayed_complete_ = false; |
626 | 632 |
627 // Error return from DestinationError. Stored separately from | 633 // Error return from DestinationError. Stored separately from |
628 // last_reason_ so that we can avoid handling destination errors until | 634 // last_reason_ so that we can avoid handling destination errors until |
629 // after file name determination has occurred. | 635 // after file name determination has occurred. |
630 DownloadInterruptReason destination_error_ = DOWNLOAD_INTERRUPT_REASON_NONE; | 636 DownloadInterruptReason destination_error_ = DOWNLOAD_INTERRUPT_REASON_NONE; |
631 | 637 |
632 // The following fields describe the current state of the download file. | 638 // The following fields describe the current state of the download file. |
633 | 639 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 const net::NetLogWithSource net_log_; | 691 const net::NetLogWithSource net_log_; |
686 | 692 |
687 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; | 693 base::WeakPtrFactory<DownloadItemImpl> weak_ptr_factory_; |
688 | 694 |
689 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); | 695 DISALLOW_COPY_AND_ASSIGN(DownloadItemImpl); |
690 }; | 696 }; |
691 | 697 |
692 } // namespace content | 698 } // namespace content |
693 | 699 |
694 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ | 700 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_H_ |
OLD | NEW |