Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TriggerConditions.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TriggerConditions.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TriggerConditions.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c9a6fd6d67f9d1e18a1bc66dc14ef2d56a235d17 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TriggerConditions.java |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.offlinepages; |
| + |
| +/** Set of system conditions to trigger background processing. */ |
| +public class TriggerConditions { |
| + private final boolean mRequirePowerConnected; |
| + private final int mMinimumBatteryPercentage; |
| + private final boolean mRequireUnmeteredNetwork; |
| + |
| + /** |
| + * Creates set of device network and power conditions for triggering processing. |
|
fgorski
2016/06/20 22:46:54
device, network
dougarnett
2016/06/22 19:54:18
Done.
|
| + * @param requirePowerConnected whether to require that device is connected to power |
| + * @param minimumBatteryPercentage minimum percentage (0-100) of remaining battery power |
| + * @param requireUnmeteredNetwork whether to require connection to unmetered network |
| + */ |
| + public TriggerConditions(boolean requirePowerConnected, int minimumBatteryPercentage, |
| + boolean requireUnmeteredNetwork) { |
| + mRequirePowerConnected = requirePowerConnected; |
| + mMinimumBatteryPercentage = minimumBatteryPercentage; |
| + mRequireUnmeteredNetwork = requireUnmeteredNetwork; |
| + } |
| + |
| + /** Returns whether connection to power is required. */ |
| + public boolean requirePowerConnected() { |
| + return mRequirePowerConnected; |
| + } |
| + |
| + /** Returns the minimum battery percentage that is required. */ |
| + public int getMinimumBatteryPercentage() { |
| + return mMinimumBatteryPercentage; |
| + } |
| + |
| + /** Returns whether connection to an unmetered network is required. */ |
| + public boolean requireUnmeteredNetwork() { |
| + return mRequireUnmeteredNetwork; |
| + } |
| +} |