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

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: Add a comment. 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..5013c367254afd23d85a94c644b1c266956231e1 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 request coordinator is
dougarnett 2016/08/19 19:35:59 Consider if this wording may be better for api con
dewittj 2016/08/19 20:21:17 Done.
+ * unavailable.
+ *
+ * @param requests The requests to remove
+ * @param callback Called when the removal is done, with the SavePageRequest objects that were
+ * actually removed.
+ */
+ public void clearRequestsFromQueue(
dougarnett 2016/08/19 18:26:31 Wonder why introduce "clear" terminology vs. remov
dewittj 2016/08/19 20:21:17 Done.
+ List<SavePageRequest> requests, Callback<SavePageRequest[]> callback) {
+ long[] requestIds = new long[requests.size()];
+ for (int i = 0; i < requests.size(); i++) {
+ requestIds[i] = requests.get(i).getRequestId();
+ }
+ nativeClearRequestsFromQueue(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 nativeClearRequestsFromQueue(
+ 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