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

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

Issue 2705283003: Added last_access_time to DownloadItem and History DB (Closed)
Patch Set: rebase + Java accessor 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 b1957ab604da102d286647b0ec1d842cce67eef4..df4a7f826c08fc167e60b7dcd187729d8389f041 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -145,6 +145,7 @@ DownloadItemImpl::DownloadItemImpl(
DownloadDangerType danger_type,
DownloadInterruptReason interrupt_reason,
bool opened,
+ const base::Time& last_access_time,
const std::vector<DownloadItem::ReceivedSlice>& received_slices,
const net::NetLogWithSource& net_log)
: guid_(base::ToUpperASCII(guid)),
@@ -166,6 +167,7 @@ DownloadItemImpl::DownloadItemImpl(
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),
@@ -458,6 +460,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);
@@ -771,6 +774,10 @@ bool DownloadItemImpl::GetOpened() const {
return opened_;
}
+base::Time DownloadItemImpl::GetLastAccessTime() const {
+ return last_access_time_;
+}
+
BrowserContext* DownloadItemImpl::GetBrowserContext() const {
return delegate_->GetBrowserContext();
}
@@ -810,6 +817,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