Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: content/public/test/fake_download_item.h

Issue 2787303002: [NTP::Downloads] Use last access time to filter old asset downloads. (Closed)
Patch Set: clean rebase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ 5 #ifndef CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_
6 #define CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ 6 #define CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 void SetOriginalUrl(const GURL& url); 66 void SetOriginalUrl(const GURL& url);
67 const GURL& GetOriginalUrl() const override; 67 const GURL& GetOriginalUrl() const override;
68 68
69 void SetLastReason(DownloadInterruptReason last_reason); 69 void SetLastReason(DownloadInterruptReason last_reason);
70 DownloadInterruptReason GetLastReason() const override; 70 DownloadInterruptReason GetLastReason() const override;
71 71
72 void SetReceivedBytes(int64_t received_bytes); 72 void SetReceivedBytes(int64_t received_bytes);
73 int64_t GetReceivedBytes() const override; 73 int64_t GetReceivedBytes() const override;
74 74
75 void SetLastAccessTime(base::Time time) override;
76 base::Time GetLastAccessTime() const override;
77
75 // The methods below are not supported and are not expected to be called. 78 // The methods below are not supported and are not expected to be called.
76 void ValidateDangerousDownload() override; 79 void ValidateDangerousDownload() override;
77 void StealDangerousDownload(bool delete_file_afterward, 80 void StealDangerousDownload(bool delete_file_afterward,
78 const AcquireFileCallback& callback) override; 81 const AcquireFileCallback& callback) override;
79 void Pause() override; 82 void Pause() override;
80 void Resume() override; 83 void Resume() override;
81 void Cancel(bool user_cancel) override; 84 void Cancel(bool user_cancel) override;
82 void Remove() override; 85 void Remove() override;
83 void OpenDownload() override; 86 void OpenDownload() override;
84 void ShowDownloadInShell() override; 87 void ShowDownloadInShell() override;
(...skipping 29 matching lines...) Expand all
114 bool AllDataSaved() const override; 117 bool AllDataSaved() const override;
115 int64_t GetTotalBytes() const override; 118 int64_t GetTotalBytes() const override;
116 const std::vector<DownloadItem::ReceivedSlice>& GetReceivedSlices() 119 const std::vector<DownloadItem::ReceivedSlice>& GetReceivedSlices()
117 const override; 120 const override;
118 bool CanShowInFolder() override; 121 bool CanShowInFolder() override;
119 bool CanOpenDownload() override; 122 bool CanOpenDownload() override;
120 bool ShouldOpenFileBasedOnExtension() override; 123 bool ShouldOpenFileBasedOnExtension() override;
121 bool GetOpenWhenComplete() const override; 124 bool GetOpenWhenComplete() const override;
122 bool GetAutoOpened() override; 125 bool GetAutoOpened() override;
123 bool GetOpened() const override; 126 bool GetOpened() const override;
124 base::Time GetLastAccessTime() const override;
125 bool IsTransient() const override; 127 bool IsTransient() const override;
126 BrowserContext* GetBrowserContext() const override; 128 BrowserContext* GetBrowserContext() const override;
127 WebContents* GetWebContents() const override; 129 WebContents* GetWebContents() const override;
128 void OnContentCheckCompleted(DownloadDangerType danger_type) override; 130 void OnContentCheckCompleted(DownloadDangerType danger_type) override;
129 void SetOpenWhenComplete(bool open) override; 131 void SetOpenWhenComplete(bool open) override;
130 void SetOpened(bool opened) override; 132 void SetOpened(bool opened) override;
131 void SetLastAccessTime(base::Time time) override;
132 void SetDisplayName(const base::FilePath& name) override; 133 void SetDisplayName(const base::FilePath& name) override;
133 std::string DebugString(bool verbose) const override; 134 std::string DebugString(bool verbose) const override;
134 135
135 private: 136 private:
136 base::ObserverList<Observer> observers_; 137 base::ObserverList<Observer> observers_;
137 uint32_t id_ = 0; 138 uint32_t id_ = 0;
138 std::string guid_; 139 std::string guid_;
139 GURL url_; 140 GURL url_;
140 base::FilePath file_path_; 141 base::FilePath file_path_;
141 bool is_file_externally_removed_ = false; 142 bool is_file_externally_removed_ = false;
142 base::Time start_time_; 143 base::Time start_time_;
143 base::Time end_time_; 144 base::Time end_time_;
145 base::Time last_access_time_;
144 // MAX_DOWNLOAD_STATE is used as the uninitialized state. 146 // MAX_DOWNLOAD_STATE is used as the uninitialized state.
145 DownloadState download_state_ = 147 DownloadState download_state_ =
146 DownloadItem::DownloadState::MAX_DOWNLOAD_STATE; 148 DownloadItem::DownloadState::MAX_DOWNLOAD_STATE;
147 std::string mime_type_; 149 std::string mime_type_;
148 GURL original_url_; 150 GURL original_url_;
149 DownloadInterruptReason last_reason_ = 151 DownloadInterruptReason last_reason_ =
150 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE; 152 DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE;
151 int64_t received_bytes_ = 0; 153 int64_t received_bytes_ = 0;
152 154
153 // The members below are to be returned by methods, which return by reference. 155 // The members below are to be returned by methods, which return by reference.
154 std::string dummy_string; 156 std::string dummy_string;
155 std::vector<GURL> dummy_url_vector; 157 std::vector<GURL> dummy_url_vector;
156 GURL dummy_url; 158 GURL dummy_url;
157 base::FilePath dummy_file_path; 159 base::FilePath dummy_file_path;
158 160
159 DISALLOW_COPY_AND_ASSIGN(FakeDownloadItem); 161 DISALLOW_COPY_AND_ASSIGN(FakeDownloadItem);
160 }; 162 };
161 163
162 } // namespace content 164 } // namespace content
163 165
164 #endif // CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_ 166 #endif // CONTENT_PUBLIC_TEST_FAKE_DOWNLOAD_ITEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc ('k') | content/public/test/fake_download_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698