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