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

Unified Diff: components/offline_pages/background/request_queue.cc

Issue 2219393004: Adds an observer for the request coordinator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resumeAPI
Patch Set: Fix nits. 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: components/offline_pages/background/request_queue.cc
diff --git a/components/offline_pages/background/request_queue.cc b/components/offline_pages/background/request_queue.cc
index 6d1e8bf8a3925f99f087fb843bc70e7a3aa6b941..155072b5a69e4c0be49204a07a80832e43720b7e 100644
--- a/components/offline_pages/background/request_queue.cc
+++ b/components/offline_pages/background/request_queue.cc
@@ -39,6 +39,7 @@ void AddRequestDone(const RequestQueue::AddRequestCallback& callback,
}
// Completes the update request call.
+// TODO(petewil): Move callers to the UpdateMultipleRequestDone callback
void UpdateRequestDone(const RequestQueue::UpdateRequestCallback& callback,
RequestQueueStore::UpdateStatus status) {
RequestQueue::UpdateRequestResult result =
@@ -48,12 +49,20 @@ void UpdateRequestDone(const RequestQueue::UpdateRequestCallback& callback,
callback.Run(result);
}
+// Handles updating multiple requests at the same time.
+void UpdateMultipleRequestsDone(
+ const RequestQueue::UpdateMultipleRequestsCallback& callback,
+ const RequestQueue::UpdateMultipleRequestResults& results,
+ const std::vector<SavePageRequest>& requests) {
+ callback.Run(results, requests);
+}
// Completes the remove request call.
void RemoveRequestsDone(
const RequestQueue::RemoveRequestsCallback& callback,
- const RequestQueue::UpdateMultipleRequestResults& results) {
- callback.Run(results);
+ const RequestQueue::UpdateMultipleRequestResults& results,
+ const std::vector<SavePageRequest>& requests) {
+ callback.Run(results, requests);
}
} // namespace
@@ -133,9 +142,9 @@ void RequestQueue::RemoveRequests(const std::vector<int64_t>& request_ids,
void RequestQueue::ChangeRequestsState(
const std::vector<int64_t>& request_ids,
const SavePageRequest::RequestState new_state,
- const UpdateRequestCallback& callback) {
+ const UpdateMultipleRequestsCallback& callback) {
store_->ChangeRequestsState(request_ids, new_state,
- base::Bind(UpdateRequestDone, callback));
+ base::Bind(UpdateMultipleRequestsDone, callback));
}
void RequestQueue::PurgeRequests(const PurgeRequestsCallback& callback) {}

Powered by Google App Engine
This is Rietveld 408576698