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

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

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 | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/offliner_policy.h
diff --git a/components/offline_pages/background/offliner_policy.h b/components/offline_pages/background/offliner_policy.h
index ee2cc0db615b05a614ff0ce23379ac3e1fa54196..972851f70891b586256f0dc40b468ce07cb14107 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -36,22 +36,37 @@ class OfflinerPolicy {
bool RetryCountIsMoreImportantThanRecency() { return true; }
// The max number of times we will retry a request.
- int GetMaxRetries() { return kMaxRetries; }
+ int GetMaxRetries() const { return kMaxRetries; }
+
+ bool PowerRequiredForUserRequestedPage() const { return false; }
+
+ bool PowerRequiredForNonUserRequestedPage() const { return true; }
+
+ bool UnmeteredNetworkRequiredForUserRequestedPage() const { return false; }
+
+ bool UnmeteredNetworkRequiredForNonUserRequestedPage() const { return true; }
+
+ int BatteryPercentageRequiredForUserRequestedPage() const { return 50; }
+
+ // This is so low because we require the device to be plugged in and charging.
+ // If we decide to allow non-user requested pages when not plugged in, we
+ // should raise this somewhat higher.
+ int BatteryPercentageRequiredForNonUserRequestedPage() const { return 25; }
// How many seconds to keep trying new pages for, before we give up, and
// return to the scheduler.
- int GetBackgroundProcessingTimeBudgetSeconds() {
+ int GetBackgroundProcessingTimeBudgetSeconds() const {
return kBackgroundTimeBudgetSeconds;
}
// How long do we allow a page to load before giving up on it
- int GetSinglePageTimeBudgetInSeconds() {
+ int GetSinglePageTimeBudgetInSeconds() const {
return kSinglePageTimeBudgetSeconds;
}
// How much battery must we have before fetching a page not explicitly
// requested by the user?
- int GetMinimumBatteryPercentageForNonUserRequestOfflining() {
+ int GetMinimumBatteryPercentageForNonUserRequestOfflining() const {
return kMinimumBatteryPercentageForNonUserRequestOfflining;
}
};
« no previous file with comments | « no previous file | components/offline_pages/background/request_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698