Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java

Issue 2659813006: Always get device conditions from Java for every attempt. (Closed)
Patch Set: Change JNI interface to use 3 small methods instead of an object. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 org.chromium.base.Callback; 7 import org.chromium.base.Callback;
8 import org.chromium.base.ContextUtils; 8 import org.chromium.base.ContextUtils;
9 import org.chromium.base.annotations.CalledByNative; 9 import org.chromium.base.annotations.CalledByNative;
10 import org.chromium.base.annotations.JNINamespace; 10 import org.chromium.base.annotations.JNINamespace;
(...skipping 29 matching lines...) Expand all
40 private static void backupSchedule(TriggerConditions triggerConditions, long delayInSeconds) { 40 private static void backupSchedule(TriggerConditions triggerConditions, long delayInSeconds) {
41 BackgroundScheduler.backupSchedule(ContextUtils.getApplicationContext(), triggerConditions, 41 BackgroundScheduler.backupSchedule(ContextUtils.getApplicationContext(), triggerConditions,
42 delayInSeconds); 42 delayInSeconds);
43 } 43 }
44 44
45 @CalledByNative 45 @CalledByNative
46 private static void unschedule() { 46 private static void unschedule() {
47 BackgroundScheduler.unschedule(ContextUtils.getApplicationContext()); 47 BackgroundScheduler.unschedule(ContextUtils.getApplicationContext());
48 } 48 }
49 49
50 @CalledByNative
51 private static boolean getPowerConditions() {
52 return BackgroundScheduler.getPowerConditions(ContextUtils.getApplicatio nContext());
53 }
54
55 @CalledByNative
56 private static int getBatteryConditions() {
57 return BackgroundScheduler.getBatteryConditions(ContextUtils.getApplicat ionContext());
58 }
59
60 @CalledByNative
61 private static int getNetworkConditions() {
62 return BackgroundScheduler.getNetworkConditions(ContextUtils.getApplicat ionContext());
63 }
64
65
50 /** 66 /**
51 * Used by native code to create and pass up Java object encapsulating the 67 * Used by native code to create and pass up Java object encapsulating the
52 * trigger conditions. 68 * trigger conditions.
53 */ 69 */
54 @CalledByNative 70 @CalledByNative
55 private static TriggerConditions createTriggerConditions(boolean requirePowe rConnected, 71 private static TriggerConditions createTriggerConditions(boolean requirePowe rConnected,
56 int minimumBatteryPercentage, boolean requireUnmeteredNetwork) { 72 int minimumBatteryPercentage, boolean requireUnmeteredNetwork) {
57 return new TriggerConditions( 73 return new TriggerConditions(
58 requirePowerConnected, minimumBatteryPercentage, requireUnmetere dNetwork); 74 requirePowerConnected, minimumBatteryPercentage, requireUnmetere dNetwork);
59 } 75 }
60 76
61 /** Instructs the native RequestCoordinator to start processing. */ 77 /** Instructs the native RequestCoordinator to start processing. */
62 private static native boolean nativeStartScheduledProcessing(boolean powerCo nnected, 78 private static native boolean nativeStartScheduledProcessing(boolean powerCo nnected,
63 int batteryPercentage, int netConnectionType, Callback<Boolean> call back); 79 int batteryPercentage, int netConnectionType, Callback<Boolean> call back);
64 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698