Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java |
| index b8c90d046da508744946215b385b114b1593c845..533e65c54f3c25663de57998554405b6fef5b289 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java |
| @@ -5,6 +5,7 @@ |
| package org.chromium.chrome.browser; |
| import android.content.Context; |
| +import android.os.Bundle; |
| import com.google.android.gms.gcm.GcmNetworkManager; |
| import com.google.android.gms.gcm.GcmTaskService; |
| @@ -14,11 +15,11 @@ import org.chromium.base.Log; |
| import org.chromium.base.ThreadUtils; |
| import org.chromium.base.VisibleForTesting; |
| import org.chromium.base.annotations.SuppressFBWarnings; |
| -import org.chromium.base.library_loader.LibraryLoader; |
| import org.chromium.base.library_loader.ProcessInitException; |
| import org.chromium.chrome.browser.init.ChromeBrowserInitializer; |
| import org.chromium.chrome.browser.ntp.snippets.SnippetsBridge; |
| import org.chromium.chrome.browser.ntp.snippets.SnippetsLauncher; |
| +import org.chromium.chrome.browser.offlinepages.BackgroundTask; |
| import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; |
| import org.chromium.chrome.browser.precache.PrecacheController; |
| @@ -44,7 +45,7 @@ public class ChromeBackgroundService extends GcmTaskService { |
| break; |
| case OfflinePageUtils.TASK_TAG: |
| - handleOfflinePageBackgroundLoad(context); |
| + handleOfflinePageBackgroundLoad(context, params.getExtras()); |
| break; |
| case SnippetsLauncher.TASK_TAG_WIFI_CHARGING: |
| @@ -124,12 +125,16 @@ public class ChromeBackgroundService extends GcmTaskService { |
| PrecacheController.get(context).precache(tag); |
| } |
| - private void handleOfflinePageBackgroundLoad(Context context) { |
| - // Gather UMA data to measure how often the user's machine is amenable to background |
| - // loading when we wake to do a task. |
| - if (LibraryLoader.isInitialized()) { |
| - OfflinePageUtils.recordWakeupUMA(context); |
| + private void handleOfflinePageBackgroundLoad(Context context, Bundle bundle) { |
|
dewittj
2016/05/25 23:16:44
All the other methods are @VisibleForTesting - is
Pete Williamson
2016/05/25 23:59:57
Tests for this patch are coming in another patch I
|
| + if (!hasPrecacheInstance()) { |
| + launchBrowser(context); |
| } |
| + |
| + // Call BackgroundTask, provide context. |
| + BackgroundTask task = new BackgroundTask(); |
| + task.processBackgroundRequests(context, bundle); |
| + // TODO(petewil) if processBackgroundRequest returns false,return RESTART_RESCHEDULE |
| + // to the GcmNetworkManager |
| } |
| @VisibleForTesting |