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(); |