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

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

Issue 2720613002: Downloads: Added transient flag to download item and download database (Closed)
Patch Set: fix tests Created 3 years, 9 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 5c825b5ae6ec26a57de1fbc6727e0ff90a0ea42c..97c41e830bf3d0497df7ecacc5688d2c50b7bb49 100644
--- a/chrome/browser/android/download/download_manager_service.cc
+++ b/chrome/browser/android/download/download_manager_service.cc
@@ -41,7 +41,7 @@ int kDefaultAutoResumptionLimit = 5;
const char kAutoResumptionLimitVariation[] = "AutoResumptionLimit";
bool ShouldShowDownloadItem(content::DownloadItem* item) {
- return !item->IsTemporary();
+ return !item->IsTemporary() && item->IsVisible();
}
void UpdateNotifier(DownloadManagerService* service,
@@ -57,6 +57,7 @@ void UpdateNotifier(DownloadManagerService* service,
ScopedJavaLocalRef<jobject> CreateJavaDownloadItem(
JNIEnv* env, content::DownloadItem* item) {
+ DCHECK(item->IsVisible());
return Java_DownloadItem_createDownloadItem(
env, DownloadManagerService::CreateJavaDownloadInfo(env, item),
item->GetStartTime().ToJavaTime(), item->GetFileExternallyRemoved());
@@ -304,6 +305,8 @@ void DownloadManagerService::OnHistoryQueryComplete() {
void DownloadManagerService::OnDownloadCreated(
content::DownloadManager* manager, content::DownloadItem* item) {
+ if (!item->IsVisible())
+ return;
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jobject> j_item = CreateJavaDownloadItem(env, item);
@@ -316,7 +319,7 @@ void DownloadManagerService::OnDownloadUpdated(
if (java_ref_.is_null())
return;
- if (item->IsTemporary())
+ if (item->IsTemporary() || !item->IsVisible())
return;
JNIEnv* env = base::android::AttachCurrentThread();
@@ -327,7 +330,7 @@ void DownloadManagerService::OnDownloadUpdated(
void DownloadManagerService::OnDownloadRemoved(
content::DownloadManager* manager, content::DownloadItem* item) {
- if (java_ref_.is_null())
+ if (java_ref_.is_null() || !item->IsVisible())
return;
JNIEnv* env = base::android::AttachCurrentThread();

Powered by Google App Engine
This is Rietveld 408576698