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

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

Issue 2705283003: Added last_access_time to DownloadItem and History DB (Closed)
Patch Set: Fix tests 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..24f40e8d05ff1b74d90f4a523375f08f6accc07c 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),
@@ -210,6 +212,7 @@ DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate,
start_time_(info.start_time),
delegate_(delegate),
is_temporary_(!info.save_info->file_path.empty()),
+ last_access_time_(base::Time()),
David Trainor- moved to gerrit 2017/02/22 05:56:03 Don't need this
shaktisahu 2017/02/23 06:55:48 Done.
last_modified_time_(info.last_modified),
etag_(info.etag),
net_log_(net_log),
@@ -248,6 +251,7 @@ DownloadItemImpl::DownloadItemImpl(
state_(IN_PROGRESS_INTERNAL),
start_time_(base::Time::Now()),
delegate_(delegate),
+ last_access_time_(base::Time()),
David Trainor- moved to gerrit 2017/02/22 05:56:03 Don't need this
shaktisahu 2017/02/23 06:55:49 Done.
current_path_(path),
net_log_(net_log),
weak_ptr_factory_(this) {
@@ -455,6 +459,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 +768,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 +811,11 @@ void DownloadItemImpl::SetOpened(bool opened) {
opened_ = opened;
}
+void DownloadItemImpl::UpdateLastAccessTime() {
+ last_access_time_ = base::Time::Now();
+ UpdateObservers();
+}
+
void DownloadItemImpl::SetDisplayName(const base::FilePath& name) {
display_name_ = name;
}

Powered by Google App Engine
This is Rietveld 408576698