| Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
|
| index ca4de080c807cea4c26b2de94f42ef0fb3c980f8..8b0f7eb04a03b42317e0444325e4ebc3358ea15b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java
|
| @@ -236,11 +236,37 @@ public class OfflinePageUtils {
|
| };
|
| }
|
|
|
| + /**
|
| + * Returns a class encapsulating the current power, battery, and network conditions.
|
| + */
|
| public static DeviceConditions getDeviceConditions(Context context) {
|
| return getInstance().getDeviceConditionsImpl(context);
|
| }
|
|
|
| /**
|
| + * Return true if the device is plugged into wall power.
|
| + */
|
| + public static boolean getPowerConditions(Context context) {
|
| + // TODO(petewil): refactor to get power, network, and battery directly from both here and
|
| + // getDeviceConditionsImpl instead of always making a DeviceConditions object.
|
| + return getInstance().getDeviceConditionsImpl(context).isPowerConnected();
|
| + }
|
| +
|
| + /**
|
| + * Get the percentage of battery remaining
|
| + */
|
| + public static int getBatteryConditions(Context context) {
|
| + return getInstance().getDeviceConditionsImpl(context).getBatteryPercentage();
|
| + }
|
| +
|
| + /**
|
| + * Returns an enum representing the type of the network connection.
|
| + */
|
| + public static int getNetworkConditions(Context context) {
|
| + return getInstance().getDeviceConditionsImpl(context).getNetConnectionType();
|
| + }
|
| +
|
| + /**
|
| * Records UMA data when the Offline Pages Background Load service awakens.
|
| * @param context android context
|
| */
|
|
|