Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..952c87a98d43f35d372b516f81b7f7581b20b510 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.offlinepages; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.base.annotations.JNINamespace; |
| +import org.chromium.chrome.browser.profiles.Profile; |
| + |
| +/** |
| + * Provides Java scheduling support from native offlining code as |
| + * well as JNI interface to tell native code to start processing |
| + * queued requests. |
| + */ |
| +@JNINamespace("offline_pages::android") |
| +public class BackgroundSchedulerBridge { |
| + |
| + /** |
| + * Callback used to determine when request processing is done. |
| + */ |
| + public interface ProcessingDoneCallback { |
| + @CalledByNative("ProcessingDoneCallback") |
| + void onResult(); |
|
fgorski
2016/04/28 11:44:00
Do we not want to pass anything for result? Even i
dougarnett
2016/04/28 22:45:23
I think we will want to return boolean - possible
|
| + } |
| + |
| + public static boolean startProcessing( |
|
fgorski
2016/04/28 11:44:00
documentation.
dougarnett
2016/04/28 22:45:23
Done.
|
| + Profile profile, ProcessingDoneCallback callback) { |
| + return nativeStartProcessing(profile, callback); |
| + } |
| + |
| + @CalledByNative |
| + private static void ensureScheduled() { |
|
fgorski
2016/04/28 11:44:00
schedule/unschedule.
After all the semantics of b
dougarnett
2016/04/28 22:45:23
As discussed, do like that better along with addin
|
| + // TODO(dougarnett): call GcmNetworkManager to schedule for |
| + // OfflinePageUtils.TASK_TAG. |
| + } |
| + |
| + @CalledByNative |
| + private static void clearScheduled() { |
| + // TODO(dougarnett): call GcmNetworkManager to unschedule for |
| + // OfflinePageUtils.TASK_TAG. |
| + } |
| + |
| + private static native boolean nativeStartProcessing( |
| + Profile profile, ProcessingDoneCallback callback); |
| +} |
| + |