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

Unified Diff: components/offline_pages/background/request_coordinator.h

Issue 2202113002: API to provide status of save page reqeusts to API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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_coordinator.h
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index c757702b01bace4e290c725600225bb70b7e3e28..ac996cd932212371762176a03f4b359eec283b3e 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -17,6 +17,7 @@
#include "components/offline_pages/background/offliner.h"
#include "components/offline_pages/background/request_coordinator_event_logger.h"
#include "components/offline_pages/background/request_queue.h"
+#include "components/offline_pages/background/request_status.h"
#include "components/offline_pages/background/scheduler.h"
#include "url/gurl.h"
@@ -50,6 +51,17 @@ class RequestCoordinator : public KeyedService {
bool SavePageLater(
const GURL& url, const ClientId& client_id, bool user_reqeusted);
+ // Callback that receives the response for GetRequestStatuses. Client must
+ // copy the result right away, it goes out of scope at the end of the
+ // callback.
+ typedef base::Callback<void(const std::vector<RequestStatus>&)>
+ RequestStatusCallback;
+
+ // For a client namespace, get the status of all requests in the request queue
+ // for that namespace.
+ void GetRequestStatuses(
+ std::string client_namespace, RequestStatusCallback callback);
fgorski 2016/08/02 04:18:12 const&, const&
Pete Williamson 2016/08/03 00:24:32 Done.
+
// Starts processing of one or more queued save page later requests.
// Returns whether processing was started and that caller should expect
// a callback. If processing was already active, returns false.
@@ -95,9 +107,19 @@ class RequestCoordinator : public KeyedService {
}
private:
+ // Receives the results of a get from the request queue, and turns that into
+ // RequestStatus objects for the caller of GetRequestStatuses.
+ void GetRequestStatusesCallback(
+ std::string client_namespace,
fgorski 2016/08/02 04:18:12 const&
Pete Williamson 2016/08/03 00:24:31 Done.
+ RequestStatusCallback callback,
+ RequestQueue::GetRequestsResult result,
+ const std::vector<SavePageRequest>& requests);
+
+ // Gets the result of add requests to the request queue.
dougarnett 2016/08/02 20:39:28 Maybe match the previous doc style here and next o
Pete Williamson 2016/08/03 00:24:31 Done.
void AddRequestResultCallback(RequestQueue::AddRequestResult result,
const SavePageRequest& request);
+ // Gets the result of update and delete reqeusts to the request queue.
dougarnett 2016/08/02 20:39:28 requests
Pete Williamson 2016/08/03 00:24:31 Done.
void UpdateRequestCallback(RequestQueue::UpdateRequestResult result);
// Callback from the request picker when it has chosen our next request.

Powered by Google App Engine
This is Rietveld 408576698