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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/DownloadController.java

Issue 1684293002: Separate download cancel handling from download failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « content/browser/android/download_controller_android_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/DownloadController.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/DownloadController.java b/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
index b19060989ae6391271b5fd11afa2bf1f8ee4d43f..cfd0f45566c3c43e707b3097f7f4198f65a22942 100644
--- a/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
@@ -5,7 +5,6 @@
package org.chromium.content.browser;
import android.Manifest.permission;
-import android.content.Context;
import android.content.pm.PackageManager;
import org.chromium.base.annotations.CalledByNative;
@@ -37,6 +36,12 @@ public class DownloadController {
* @param downloadInfo Information about the in-progress download.
*/
void onDownloadUpdated(final DownloadInfo downloadInfo);
+
+ /**
+ * Notify the host application that a download is cancelled.
+ * @param downloadId Id of the download.
+ */
+ void onDownloadCancelled(final DownloadInfo downloadInfo);
}
private static DownloadNotificationService sDownloadNotificationService;
@@ -109,7 +114,7 @@ public class DownloadController {
* download. This can be either a POST download or a GET download with authentication.
*/
@CalledByNative
- private void onDownloadCompleted(Context context, String url, String mimeType,
+ private void onDownloadCompleted(String url, String mimeType,
String filename, String path, long contentLength, boolean successful, int downloadId,
boolean hasUserGesture) {
if (sDownloadNotificationService != null) {
@@ -130,11 +135,26 @@ public class DownloadController {
}
/**
+ * Called when a download was cancelled.
+ * @param downloadId Id of the download item.
+ */
+ @CalledByNative
+ private void onDownloadCancelled(int downloadId) {
+ if (sDownloadNotificationService != null) {
+ DownloadInfo downloadInfo = new DownloadInfo.Builder()
+ .setDownloadId(downloadId)
+ .setHasDownloadId(true)
+ .build();
+ sDownloadNotificationService.onDownloadCancelled(downloadInfo);
+ }
+ }
+
+ /**
* Notifies the download delegate about progress of a download. Downloads that use Chrome
* network stack use custom notification to display the progress of downloads.
*/
@CalledByNative
- private void onDownloadUpdated(Context context, String url, String mimeType, String filename,
+ private void onDownloadUpdated(String url, String mimeType, String filename,
String path, long contentLength, boolean successful, int downloadId,
int percentCompleted, long timeRemainingInMs, boolean hasUserGesture,
boolean isResumable) {
« no previous file with comments | « content/browser/android/download_controller_android_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698