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

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

Issue 2176393004: Add expiration policy, code to check it, and a test. (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/offliner_policy.h
diff --git a/components/offline_pages/background/offliner_policy.h b/components/offline_pages/background/offliner_policy.h
index 5aba61d08c894416f6e395389d63d78221ff273c..f914cb6b3ac981324a512e8cd54e9852fc61b1a3 100644
--- a/components/offline_pages/background/offliner_policy.h
+++ b/components/offline_pages/background/offliner_policy.h
@@ -10,6 +10,7 @@ const int kMaxRetries = 2;
const int kBackgroundTimeBudgetSeconds = 170;
const int kSinglePageTimeBudgetSeconds = 120;
const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50;
+const int kPageExpirationTimeInSeconds = 60 * 60 * 24 * 7;
} // namespace
namespace offline_pages {
@@ -58,7 +59,7 @@ class OfflinerPolicy {
bool UnmeteredNetworkRequiredForNonUserRequestedPage() const { return true; }
- int BatteryPercentageRequiredForUserRequestedPage() const { return 50; }
+ int BatteryPercentageRequiredForUserRequestedPage() const { return 0; }
// 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
@@ -76,6 +77,11 @@ class OfflinerPolicy {
return kSinglePageTimeBudgetSeconds;
}
+ // How long we allow requests to remain in the system before giving up.
+ int GetPageExpirationTimeInSeconds() const {
dougarnett 2016/07/27 15:45:13 Actually seems to be "Request" expiration rather t
Pete Williamson 2016/07/27 17:20:06 Done.
+ return kPageExpirationTimeInSeconds;
+ }
+
// How much battery must we have before fetching a page not explicitly
// requested by the user?
int GetMinimumBatteryPercentageForNonUserRequestOfflining() const {

Powered by Google App Engine
This is Rietveld 408576698