Chromium Code Reviews| 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..3f8273de9c2347cec89d24506d9fd9604a4c4396 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,19 +64,27 @@ 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 PowerRequired(bool user_requested) const { |
| + if (user_requested) |
| + return false; |
| + return true; |
| + } |
| - bool UnmeteredNetworkRequiredForNonUserRequestedPage() const { return true; } |
| + bool UnmeteredNetworkRequired(bool user_requested) const { |
| + if (user_requested) |
| + return false; |
| + return true; |
| + } |
| - int BatteryPercentageRequiredForUserRequestedPage() const { return 0; } |
| + 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; |
| + } |
| - // 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; } |
|
dougarnett
2016/08/29 15:47:22
delete this one too?
Pete Williamson
2016/09/01 00:10:31
Done.
|
| // How many seconds to keep trying new pages for, before we give up, and |
| @@ -96,12 +103,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_; |