| 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.Bundle; | 8 import android.os.Bundle; |
| 9 | 9 |
| 10 import com.google.android.gms.gcm.GcmNetworkManager; | 10 import com.google.android.gms.gcm.GcmNetworkManager; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 .setUpdateCurrent(overwrite) | 69 .setUpdateCurrent(overwrite) |
| 70 .setRequiredNetwork(triggerConditions.requireUnmeter
edNetwork() | 70 .setRequiredNetwork(triggerConditions.requireUnmeter
edNetwork() |
| 71 ? Task.NETWORK_STATE_UNMETERED | 71 ? Task.NETWORK_STATE_UNMETERED |
| 72 : Task.NETWORK_STATE_CONNECTED) | 72 : Task.NETWORK_STATE_CONNECTED) |
| 73 .setRequiresCharging(triggerConditions.requirePowerC
onnected()) | 73 .setRequiresCharging(triggerConditions.requirePowerC
onnected()) |
| 74 .setExtras(taskExtras) | 74 .setExtras(taskExtras) |
| 75 .build(); | 75 .build(); |
| 76 | 76 |
| 77 gcmNetworkManager.schedule(task); | 77 gcmNetworkManager.schedule(task); |
| 78 } | 78 } |
| 79 |
| 80 /** |
| 81 * Get the latest power conditions from the android APIs. |
| 82 */ |
| 83 public static boolean getPowerConditions(Context context) { |
| 84 return OfflinePageUtils.getPowerConditions(context); |
| 85 } |
| 86 |
| 87 /** |
| 88 * Get the latest battery conditions from the android APIs. |
| 89 */ |
| 90 public static int getBatteryConditions(Context context) { |
| 91 return OfflinePageUtils.getBatteryConditions(context); |
| 92 } |
| 93 |
| 94 /** |
| 95 * Get the latest network conditions from the android APIs. |
| 96 */ |
| 97 public static int getNetworkConditions(Context context) { |
| 98 return OfflinePageUtils.getNetworkConditions(context); |
| 99 } |
| 79 } | 100 } |
| OLD | NEW |