| Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
|
| index aaf8ab98679adbaaa455989eb55112c2c0a3b65b..08b02f6d8399b4d0ee00bc72965b4908c08e4297 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
|
| @@ -7,6 +7,7 @@ package org.chromium.chrome.browser.offlinepages;
|
| import org.chromium.base.ContextUtils;
|
| import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.base.annotations.JNINamespace;
|
| +import org.chromium.chrome.browser.offlinepages.interfaces.SchedulerBridge;
|
|
|
| /**
|
| * Provides Java scheduling support from native offlining code as
|
| @@ -15,14 +16,6 @@ import org.chromium.base.annotations.JNINamespace;
|
| */
|
| @JNINamespace("offline_pages::android")
|
| public class BackgroundSchedulerBridge {
|
| - /**
|
| - * Callback used to determine when request processing is done.
|
| - */
|
| - public interface ProcessingDoneCallback {
|
| - @CalledByNative("ProcessingDoneCallback")
|
| - void onProcessingDone(boolean result);
|
| - }
|
| -
|
| // Starts processing of one or more queued background requests.
|
| // Returns whether processing was started and that caller should
|
| // expect a callback (once processing has completed or terminated).
|
| @@ -31,7 +24,8 @@ public class BackgroundSchedulerBridge {
|
| // not receive a callback.
|
| // TODO(dougarnett): consider adding policy check api to let caller
|
| // separately determine if not allowed by policy.
|
| - public static boolean startProcessing(ProcessingDoneCallback callback) {
|
| + public static boolean startProcessing(
|
| + SchedulerBridge.ProcessingDoneCallback callback) {
|
| return nativeStartProcessing(callback);
|
| }
|
|
|
| @@ -45,5 +39,20 @@ public class BackgroundSchedulerBridge {
|
| BackgroundScheduler.unschedule(ContextUtils.getApplicationContext());
|
| }
|
|
|
| - private static native boolean nativeStartProcessing(ProcessingDoneCallback callback);
|
| + /**
|
| + * This interface defines the JNI callback available to native code. It must exactly match the
|
| + * {@link SchedulerBridge.ProcessingDoneCallback} interface (which is not tied to JNI and may be
|
| + * use for unit testing). Due to JNI restrictions, the interface for this callback must be
|
| + * declared in the same java file, so there is only one XXX_jni.h file to include on the C++
|
| + * side (Otherwise, we get the JNI function RegisterNativesImpl multiply defined, and can't
|
| + * compile). This interface is exactly the same as the one in SchedulerBridge, and we're using
|
| + * duck typing to make sure the callback can work.
|
| + */
|
| + public interface ProcessingDoneCallback {
|
| + @CalledByNative("ProcessingDoneCallback")
|
| + void onProcessingDone(boolean result);
|
| + }
|
| +
|
| + private static native boolean nativeStartProcessing(
|
| + SchedulerBridge.ProcessingDoneCallback callback);
|
| }
|
|
|