本文整理汇总了Java中org.chromium.chrome.browser.download.DownloadResumptionScheduler类的典型用法代码示例。如果您正苦于以下问题:Java DownloadResumptionScheduler类的具体用法?Java DownloadResumptionScheduler怎么用?Java DownloadResumptionScheduler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DownloadResumptionScheduler类属于org.chromium.chrome.browser.download包,在下文中一共展示了DownloadResumptionScheduler类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRunTask
import org.chromium.chrome.browser.download.DownloadResumptionScheduler; //导入依赖的package包/类
@Override
@VisibleForTesting
public int onRunTask(final TaskParams params) {
final String taskTag = params.getTag();
Log.i(TAG, "[" + taskTag + "] Woken up at " + new java.util.Date().toString());
final ChromeBackgroundServiceWaiter waiter = getWaiterIfNeeded(params.getExtras());
final Context context = this;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
switch (taskTag) {
case BackgroundSyncLauncher.TASK_TAG:
handleBackgroundSyncEvent(context, taskTag);
break;
case OfflinePageUtils.TASK_TAG:
handleOfflinePageBackgroundLoad(
context, params.getExtras(), waiter, taskTag);
break;
case SnippetsLauncher.TASK_TAG_WIFI:
case SnippetsLauncher.TASK_TAG_FALLBACK:
handleFetchSnippets(context, taskTag);
break;
case PrecacheController.PERIODIC_TASK_TAG:
case PrecacheController.CONTINUATION_TASK_TAG:
handlePrecache(context, taskTag);
break;
case DownloadResumptionScheduler.TASK_TAG:
DownloadResumptionScheduler.getDownloadResumptionScheduler(
context.getApplicationContext()).handleDownloadResumption();
break;
default:
Log.i(TAG, "Unknown task tag " + taskTag);
break;
}
}
});
// If needed, block the GcmNetworkManager thread until the UI thread has finished its work.
waitForTaskIfNeeded(waiter);
return GcmNetworkManager.RESULT_SUCCESS;
}