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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageDownloadBridge.java

Issue 2228193002: [Offline pages] Download UI: Adding Download Service Delegate for notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a TODO Created 4 years, 4 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/offlinepages/downloads/OfflinePageDownloadBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageDownloadBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageDownloadBridge.java
index 428353e83d7a558081c4c6901eb47668b6b202bb..c65c7907ca51865bb61ec0d4dbbb57ac9e9b6e55 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageDownloadBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageDownloadBridge.java
@@ -7,6 +7,8 @@ package org.chromium.chrome.browser.offlinepages.downloads;
import org.chromium.base.ObserverList;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
+import org.chromium.chrome.browser.download.DownloadItem;
+import org.chromium.chrome.browser.download.DownloadServiceDelegate;
import org.chromium.chrome.browser.profiles.Profile;
import java.util.ArrayList;
@@ -17,7 +19,7 @@ import java.util.List;
* displayed in the downloads UI.
*/
@JNINamespace("offline_pages::android")
-public class OfflinePageDownloadBridge {
+public class OfflinePageDownloadBridge implements DownloadServiceDelegate {
/**
* Base observer class for notifications on changes to the offline page related download items.
*/
@@ -53,6 +55,13 @@ public class OfflinePageDownloadBridge {
private long mNativeOfflinePageDownloadBridge;
private boolean mIsLoaded;
+ /**
+ * Gets DownloadServiceDelegate that is suitable for interacting with offline download items.
+ */
+ public static DownloadServiceDelegate getDownloadServiceDelegate() {
+ return new OfflinePageDownloadBridge(Profile.getLastUsedProfile());
+ }
+
public OfflinePageDownloadBridge(Profile profile) {
mNativeOfflinePageDownloadBridge = sIsTesting ? 0L : nativeInit(profile);
}
@@ -102,6 +111,19 @@ public class OfflinePageDownloadBridge {
return nativeGetItemByGuid(mNativeOfflinePageDownloadBridge, guid);
}
+ @Override
+ public void cancelDownload(String downloadGuid, boolean isOffTheRecord,
+ boolean isNotificationDismissed) {
+ }
+
+ @Override
+ public void pauseDownload(String downloadGuid, boolean isOffTheRecord) {
+ }
+
+ @Override
+ public void resumeDownload(DownloadItem item, boolean hasUserGesture) {
+ }
+
/**
* Method to ensure that the bridge is created for tests without calling the native portion of
* initialization.

Powered by Google App Engine
This is Rietveld 408576698