Commit 9ef2aa86 authored by Joy Ming's avatar Joy Ming Committed by Commit Bot

[Downloads location] Temp fix for surplus offline pages notifications.

There were surplus offline pages notifications (unintended prefetch
notifications and double offline pages notifications) because of a
doubled pathway when OfflineContentAggregatorNotificationBridgeUi is
activated. Temporarily disable OCANBUi for offline pages until a more
long-term fix is in place that can filter out notifications.

Bug: 831083,832282
Change-Id: I49095de6cb9138c2081147342fa76aab9fc8c857
Reviewed-on: https://chromium-review.googlesource.com/1011227
Commit-Queue: Joy Ming <jming@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550428}
parent b8e47921
...@@ -9,6 +9,7 @@ import org.chromium.chrome.browser.download.DownloadItem; ...@@ -9,6 +9,7 @@ import org.chromium.chrome.browser.download.DownloadItem;
import org.chromium.chrome.browser.download.DownloadNotifier; import org.chromium.chrome.browser.download.DownloadNotifier;
import org.chromium.chrome.browser.download.DownloadServiceDelegate; import org.chromium.chrome.browser.download.DownloadServiceDelegate;
import org.chromium.components.offline_items_collection.ContentId; import org.chromium.components.offline_items_collection.ContentId;
import org.chromium.components.offline_items_collection.LegacyHelpers;
import org.chromium.components.offline_items_collection.OfflineContentProvider; import org.chromium.components.offline_items_collection.OfflineContentProvider;
import org.chromium.components.offline_items_collection.OfflineItem; import org.chromium.components.offline_items_collection.OfflineItem;
import org.chromium.components.offline_items_collection.OfflineItemState; import org.chromium.components.offline_items_collection.OfflineItemState;
...@@ -147,6 +148,8 @@ public class OfflineContentAggregatorNotificationBridgeUi ...@@ -147,6 +148,8 @@ public class OfflineContentAggregatorNotificationBridgeUi
} }
private void pushItemToUi(OfflineItem item, OfflineItemVisuals visuals) { private void pushItemToUi(OfflineItem item, OfflineItemVisuals visuals) {
if (!shouldShowNotification(item)) return;
DownloadInfo info = DownloadInfo.fromOfflineItem(item, visuals); DownloadInfo info = DownloadInfo.fromOfflineItem(item, visuals);
switch (item.state) { switch (item.state) {
case OfflineItemState.IN_PROGRESS: case OfflineItemState.IN_PROGRESS:
...@@ -220,4 +223,10 @@ public class OfflineContentAggregatorNotificationBridgeUi ...@@ -220,4 +223,10 @@ public class OfflineContentAggregatorNotificationBridgeUi
return false; return false;
} }
} }
private boolean shouldShowNotification(OfflineItem item) {
// Temporarily return immediately to prevent unnecessary notifications for offline pages
// until https://crbug.com/831083 and https://crbug.com/832282 are fixed.
return !item.isTransient && !LegacyHelpers.isLegacyOfflinePage(item.id);
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment