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

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

Issue 2395903002: API changes to support suspending requests (Closed)
Patch Set: Keep the JS with a boolean instead of forcing a double. Created 4 years, 2 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 830d605e57819174e291103bb0f83ca8b3704ba9..60028d21c71a418f497fec72f373ef0ec0ed1602 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -55,6 +55,11 @@ class RequestCoordinator : public KeyedService,
virtual void OnChanged(const SavePageRequest& request) = 0;
};
+ enum class RequestAvailability {
+ ENABLED_FOR_OFFLINER,
+ DISABLED_FOR_OFFLINER,
+ };
+
// Callback to report when a request was available.
typedef base::Callback<void(const SavePageRequest& request)>
RequestPickedCallback;
@@ -71,9 +76,11 @@ class RequestCoordinator : public KeyedService,
~RequestCoordinator() override;
// Queues |request| to later load and save when system conditions allow.
- // Returns true if the page could be queued successfully.
- bool SavePageLater(
- const GURL& url, const ClientId& client_id, bool user_reqeusted);
+ // Returns an id if the page could be queued successfully, 0L otherwise.
+ int64_t SavePageLater(const GURL& url,
+ const ClientId& client_id,
+ bool user_requested,
+ RequestAvailability availability);
// Callback specifying which request IDs were actually removed.
typedef base::Callback<void(
@@ -111,6 +118,15 @@ class RequestCoordinator : public KeyedService,
// is stopped or complete.
void StopProcessing(Offliner::RequestStatus stop_status);
+ // Used to denote that the foreground thread is ready for the offliner
+ // to start work on a previously entered, but unavailable request.
+ void EnableForOffliner(int64_t request_id);
+
+ // If a request that is unavailable to the offliner is finished elsewhere,
+ // (by the tab helper synchronous download), send a notificaiton that it
+ // succeeded through our notificaiton system.
+ void MarkRequestCompleted(int64_t request_id);
+
const Scheduler::TriggerConditions GetTriggerConditions(
const bool user_requested);

Powered by Google App Engine
This is Rietveld 408576698