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

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

Issue 2177943005: Move user requested trigger conditions into policy object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make more methods const 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
« no previous file with comments | « components/offline_pages/background/request_coordinator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/request_coordinator.cc
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index a78d58cbdcfe24663f5e444c1777d3ab4155c104..df8bad99d3412380165ee7c2dc668cb530c22625 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -29,13 +29,6 @@ void RecordOfflinerResultUMA(Offliner::RequestStatus request_status) {
Offliner::RequestStatus::STATUS_COUNT);
}
-// TODO(dougarnett/petewil): Move to Policy object. Also consider lower minimum
-// battery percentage once there is some processing time limits in place.
-const Scheduler::TriggerConditions kUserRequestTriggerConditions(
- false /* require_power_connected */,
- 50 /* minimum_battery_percentage */,
- false /* require_unmetered_network */);
-
// Timeout is 2.5 minutes based on the size of Marshmallow doze mode
// maintenance window (3 minutes)
// TODO(petewil): Find the optimal timeout based on data for 2G connections and
@@ -234,9 +227,13 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
TryNextRequest();
}
-const Scheduler::TriggerConditions&
+const Scheduler::TriggerConditions
RequestCoordinator::GetTriggerConditionsForUserRequest() {
- return kUserRequestTriggerConditions;
+ Scheduler::TriggerConditions trigger_conditions(
+ policy_->PowerRequiredForUserRequestedPage(),
+ policy_->BatteryPercentageRequiredForUserRequestedPage(),
+ policy_->UnmeteredNetworkRequiredForUserRequestedPage());
+ return trigger_conditions;
}
void RequestCoordinator::GetOffliner() {
« no previous file with comments | « components/offline_pages/background/request_coordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698