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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java

Issue 2771803004: Glue OfflineContentProvider to the download service (Closed)
Patch Set: Fixing test failure 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/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java b/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
index b5016400ce57b929d9e76e06997266a0e1f8c148..3b5e6aa2f4fc367464589690733a177c88db6b4c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier.java
@@ -170,10 +170,8 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
}
@Override
- public void notifyDownloadCanceled(String downloadGuid) {
- DownloadInfo downloadInfo = new DownloadInfo.Builder()
- .setDownloadGuid(downloadGuid)
- .build();
+ public void notifyDownloadCanceled(ContentId id) {
+ DownloadInfo downloadInfo = new DownloadInfo.Builder().setContentId(id).build();
updateDownloadNotification(
new PendingNotificationInfo(DOWNLOAD_NOTIFICATION_TYPE_CANCEL, downloadInfo), true);
}
@@ -239,12 +237,16 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
/**
* Called when a successful notification is shown.
- * @param info Pending notification information to be handled.
+ * @param notificationInfo Pending notification information to be handled.
* @param notificationId ID of the notification.
*/
@VisibleForTesting
void onSuccessNotificationShown(
final PendingNotificationInfo notificationInfo, final int notificationId) {
+ if (notificationInfo.downloadInfo != null
+ && !notificationInfo.downloadInfo.getIsOpenable()) {
+ return;
+ }
DownloadManagerService.getDownloadManagerService().onSuccessNotificationShown(
notificationInfo.downloadInfo, notificationInfo.canResolve, notificationId,
notificationInfo.systemDownloadId);
@@ -278,20 +280,22 @@ public class SystemDownloadNotifier implements DownloadNotifier, Observer {
mBoundService.notifyDownloadProgress(info.getContentId(), info.getFileName(),
info.getPercentCompleted(), info.getBytesReceived(),
info.getTimeRemainingInMillis(), notificationInfo.startTime,
- info.isOffTheRecord(), notificationInfo.canDownloadWhileMetered);
+ info.isOffTheRecord(), notificationInfo.canDownloadWhileMetered,
+ info.getIsTransient());
break;
case DOWNLOAD_NOTIFICATION_TYPE_PAUSE:
- mBoundService.notifyDownloadPaused(info.getContentId(), true, false);
+ mBoundService.notifyDownloadPaused(
+ info.getContentId(), true, false, info.getIsTransient());
break;
case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT:
- mBoundService.notifyDownloadPaused(
- info.getContentId(), info.isResumable(), notificationInfo.isAutoResumable);
+ mBoundService.notifyDownloadPaused(info.getContentId(), info.isResumable(),
+ notificationInfo.isAutoResumable, info.getIsTransient());
break;
case DOWNLOAD_NOTIFICATION_TYPE_SUCCESS:
final int notificationId = mBoundService.notifyDownloadSuccessful(
info.getContentId(), info.getFilePath(), info.getFileName(),
notificationInfo.systemDownloadId, info.isOffTheRecord(),
- notificationInfo.isSupportedMimeType);
+ notificationInfo.isSupportedMimeType, info.getIsOpenable());
onSuccessNotificationShown(notificationInfo, notificationId);
break;
case DOWNLOAD_NOTIFICATION_TYPE_FAILURE:

Powered by Google App Engine
This is Rietveld 408576698