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

Unified Diff: chrome/browser/android/download/download_manager_service.cc

Issue 2705283003: Added last_access_time to DownloadItem and History DB (Closed)
Patch Set: rebase origin/master 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: chrome/browser/android/download/download_manager_service.cc
diff --git a/chrome/browser/android/download/download_manager_service.cc b/chrome/browser/android/download/download_manager_service.cc
index 65ebf678ea575d091ad2cf251a1ac5bd7f25fbbb..5c825b5ae6ec26a57de1fbc6727e0ff90a0ea42c 100644
--- a/chrome/browser/android/download/download_manager_service.cc
+++ b/chrome/browser/android/download/download_manager_service.cc
@@ -121,7 +121,8 @@ ScopedJavaLocalRef<jobject> DownloadManagerService::CreateJavaDownloadInfo(
ConvertUTF8ToJavaString(env, original_url),
ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec()),
time_remaining_known ? time_delta.InMilliseconds()
- : kUnknownRemainingTime);
+ : kUnknownRemainingTime,
+ item->GetLastAccessTime().ToJavaTime());
}
static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
@@ -239,6 +240,21 @@ void DownloadManagerService::CheckForExternallyRemovedDownloads(
manager->CheckForHistoryFilesRemoval();
}
+void DownloadManagerService::UpdateLastAccessTime(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ const JavaParamRef<jstring>& jdownload_guid,
+ bool is_off_the_record) {
+ std::string download_guid = ConvertJavaStringToUTF8(env, jdownload_guid);
+ content::DownloadManager* manager = GetDownloadManager(is_off_the_record);
+ if (!manager)
+ return;
+
+ content::DownloadItem* item = manager->GetDownloadByGuid(download_guid);
+ if (item)
+ item->SetLastAccessTime(base::Time::Now());
+}
+
void DownloadManagerService::CancelDownload(
JNIEnv* env,
jobject obj,
« no previous file with comments | « chrome/browser/android/download/download_manager_service.h ('k') | chrome/browser/apps/guest_view/web_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698