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

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

Issue 2256373002: Adds request queue removal capability to OfflinePageBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@query-queue
Patch Set: Rename some callbacks. 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/OfflinePageBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
index 727cc561830a6558714fd012e60100cf855f5cf2..1dd5c2db02c537453a30daeca791f1d8e6936b52 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageBridge.java
@@ -244,6 +244,25 @@ public class OfflinePageBridge {
nativeGetRequestsInQueue(mNativeOfflinePageBridge, callback);
}
+ /**
+ * Removes SavePageRequests from the request queue.
+ *
+ * The callback will be called with |null| in the case that the queue is unavailable. This can
+ * happen in incognito, for example.
+ *
+ * @param requests The requests to remove
+ * @param callback Called when the removal is done, with the SavePageRequest objects that were
+ * actually removed.
+ */
+ public void removeRequestsFromQueue(
+ List<SavePageRequest> requests, Callback<SavePageRequest[]> callback) {
Dmitry Titov 2016/08/19 22:30:11 It'd be cleaner if the method took a list of reque
dewittj 2016/08/20 03:22:35 Done.
+ long[] requestIds = new long[requests.size()];
+ for (int i = 0; i < requests.size(); i++) {
+ requestIds[i] = requests.get(i).getRequestId();
+ }
+ nativeRemoveRequestsFromQueue(mNativeOfflinePageBridge, requestIds, callback);
+ }
+
private List<OfflinePageItem> getPagesByClientIdInternal(ClientId clientId) {
Set<Long> ids = getOfflineIdsForClientId(clientId);
List<OfflinePageItem> result = new ArrayList<>();
@@ -536,6 +555,10 @@ public class OfflinePageBridge {
long nativeOfflinePageBridge, Callback<SavePageRequest[]> callback);
@VisibleForTesting
+ native void nativeRemoveRequestsFromQueue(
+ long nativeOfflinePageBridge, long[] requestIds, Callback<SavePageRequest[]> callback);
+
+ @VisibleForTesting
native OfflinePageItem nativeGetPageByOfflineId(long nativeOfflinePageBridge, long offlineId);
private native void nativeSelectPageForOnlineUrl(
long nativeOfflinePageBridge, String onlineUrl, int tabId,

Powered by Google App Engine
This is Rietveld 408576698