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

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

Issue 2113383002: More detailed implementation of the RequestPicker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix time check and MeetsConditions check 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 e0ff976c5ac3ea9554bb518ee712e8fc4b74c379..c059706f9f33cfd890f557126a17c5e7e60a8b7d 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -47,7 +47,8 @@ class RequestCoordinator : public KeyedService {
// 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 SavePageLater(
+ const GURL& url, const ClientId& client_id, bool was_user_reqeusted);
// Starts processing of one or more queued save page later requests.
// Returns whether processing was started and that caller should expect
@@ -123,6 +124,10 @@ class RequestCoordinator : public KeyedService {
offliner_timeout_ = timeout;
}
+ void SetDeviceConditionsForTest(DeviceConditions& current_conditions) {
+ current_conditions_.reset(new DeviceConditions(current_conditions));
+ }
+
friend class RequestCoordinatorTest;
// The offliner can only handle one request at a time - if the offliner is
@@ -135,6 +140,8 @@ class RequestCoordinator : public KeyedService {
base::TimeDelta offliner_timeout_;
// Unowned pointer to the current offliner, if any.
Offliner* offliner_;
+ // Last known conditions for network, battery
+ std::unique_ptr<DeviceConditions> current_conditions_;
// RequestCoordinator takes over ownership of the policy
std::unique_ptr<OfflinerPolicy> policy_;
// OfflinerFactory. Used to create offline pages. Owned.

Powered by Google App Engine
This is Rietveld 408576698