| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.offlinepages; | 5 package org.chromium.chrome.browser.offlinepages; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 | 9 |
| 10 import java.util.concurrent.TimeUnit; | 10 import java.util.concurrent.TimeUnit; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 * For the given Triggering conditions, start a new GCM Network Manager requ
est allowed | 65 * For the given Triggering conditions, start a new GCM Network Manager requ
est allowed |
| 66 * to run after {@code delayStartSecs} seconds. | 66 * to run after {@code delayStartSecs} seconds. |
| 67 */ | 67 */ |
| 68 protected abstract void scheduleImpl(TriggerConditions triggerConditions, | 68 protected abstract void scheduleImpl(TriggerConditions triggerConditions, |
| 69 long delayStartSeconds, long executionDeadlineSeconds, boolean overw
rite); | 69 long delayStartSeconds, long executionDeadlineSeconds, boolean overw
rite); |
| 70 | 70 |
| 71 /** @return Context used to access OS services. */ | 71 /** @return Context used to access OS services. */ |
| 72 protected Context getContext() { | 72 protected Context getContext() { |
| 73 return mContext; | 73 return mContext; |
| 74 } | 74 } |
| 75 | |
| 76 /** | |
| 77 * Get the latest power conditions from the android APIs. | |
| 78 */ | |
| 79 public static boolean getPowerConditions(Context context) { | |
| 80 return OfflinePageUtils.getPowerConditions(context); | |
| 81 } | |
| 82 | |
| 83 /** | |
| 84 * Get the latest battery conditions from the android APIs. | |
| 85 */ | |
| 86 public static int getBatteryConditions(Context context) { | |
| 87 return OfflinePageUtils.getBatteryConditions(context); | |
| 88 } | |
| 89 | |
| 90 /** | |
| 91 * Get the latest network conditions from the android APIs. | |
| 92 */ | |
| 93 public static int getNetworkConditions(Context context) { | |
| 94 return OfflinePageUtils.getNetworkConditions(context); | |
| 95 } | |
| 96 } | 75 } |
| OLD | NEW |