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

Unified Diff: content/browser/download/download_item_impl.cc

Issue 2705283003: Added last_access_time to DownloadItem and History DB (Closed)
Patch Set: comments Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 47ad0ee6944fc98bafb52c0621adf81b0e10e239..62df502a374bbd51c07234320cbcc9603baf6085 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -144,6 +144,7 @@ DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate,
DownloadDangerType danger_type,
DownloadInterruptReason interrupt_reason,
bool opened,
+ const base::Time& last_access_time,
const net::NetLogWithSource& net_log)
: guid_(base::ToUpperASCII(guid)),
download_id_(download_id),
@@ -164,6 +165,7 @@ DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate,
end_time_(end_time),
delegate_(delegate),
opened_(opened),
+ last_access_time_(last_access_time),
current_path_(current_path),
received_bytes_(received_bytes),
all_data_saved_(state == COMPLETE),
@@ -455,6 +457,7 @@ void DownloadItemImpl::OpenDownload() {
delegate_->CheckForFileRemoval(this);
RecordOpen(GetEndTime(), !GetOpened());
opened_ = true;
+ last_access_time_ = base::Time::Now();
for (auto& observer : observers_)
observer.OnDownloadOpened(this);
delegate_->OpenDownload(this);
@@ -763,6 +766,10 @@ bool DownloadItemImpl::GetOpened() const {
return opened_;
}
+base::Time DownloadItemImpl::GetLastAccessTime() const {
+ return last_access_time_;
+}
+
BrowserContext* DownloadItemImpl::GetBrowserContext() const {
return delegate_->GetBrowserContext();
}
@@ -802,6 +809,11 @@ void DownloadItemImpl::SetOpened(bool opened) {
opened_ = opened;
}
+void DownloadItemImpl::SetLastAccessTime(const base::Time& last_access_time) {
+ last_access_time_ = last_access_time;
+ UpdateObservers();
+}
+
void DownloadItemImpl::SetDisplayName(const base::FilePath& name) {
display_name_ = name;
}

Powered by Google App Engine
This is Rietveld 408576698