| 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 d640d2590a8cfae7411d8149ecbd3429f2e6c3b5..66fc7b5fa5547a5b14e0351d653f5b5228939035 100644
|
| --- a/components/offline_pages/background/offliner_policy.h
|
| +++ b/components/offline_pages/background/offliner_policy.h
|
| @@ -10,7 +10,6 @@ const int kMaxStartedTries = 5;
|
| const int kMaxCompletedTries = 1;
|
| const int kBackgroundProcessingTimeBudgetSeconds = 170;
|
| const int kSinglePageTimeLimitSeconds = 120;
|
| -const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50;
|
| const int kRequestExpirationTimeInSeconds = 60 * 60 * 24 * 7;
|
| } // namespace
|
|
|
| @@ -65,20 +64,22 @@ class OfflinerPolicy {
|
| // completed, but failed.
|
| int GetMaxCompletedTries() const { return max_completed_tries_; }
|
|
|
| - bool PowerRequiredForUserRequestedPage() const { return false; }
|
| -
|
| - bool PowerRequiredForNonUserRequestedPage() const { return true; }
|
| -
|
| - bool UnmeteredNetworkRequiredForUserRequestedPage() const { return false; }
|
| -
|
| - bool UnmeteredNetworkRequiredForNonUserRequestedPage() const { return true; }
|
| + bool PowerRequired(bool user_requested) const {
|
| + return (!user_requested);
|
| + }
|
|
|
| - int BatteryPercentageRequiredForUserRequestedPage() const { return 0; }
|
| + bool UnmeteredNetworkRequired(bool user_requested) const {
|
| + return !(user_requested);
|
| + }
|
|
|
| - // 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; }
|
| + int BatteryPercentageRequired(bool user_requested) const {
|
| + if (user_requested)
|
| + 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 should raise this somewhat higher.
|
| + return 25;
|
| + }
|
|
|
| // How many seconds to keep trying new pages for, before we give up, and
|
| // return to the scheduler.
|
| @@ -96,12 +97,6 @@ class OfflinerPolicy {
|
| return kRequestExpirationTimeInSeconds;
|
| }
|
|
|
| - // How much battery must we have before fetching a page not explicitly
|
| - // requested by the user?
|
| - int GetMinimumBatteryPercentageForNonUserRequestOfflining() const {
|
| - return kMinimumBatteryPercentageForNonUserRequestOfflining;
|
| - }
|
| -
|
| private:
|
| bool prefer_untried_requests_;
|
| bool prefer_earlier_requests_;
|
|
|