| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
| index f18c5adb864ccd11d530e97cfdd6ef2956ed93e7..bd2fcefb860146f412713c3f80405c988f4f1af0 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
| @@ -4,8 +4,6 @@
|
|
|
| package org.chromium.chrome.browser.ntp.snippets;
|
|
|
| -import android.content.Context;
|
| -
|
| import com.google.android.gms.gcm.GcmNetworkManager;
|
| import com.google.android.gms.gcm.PeriodicTask;
|
| import com.google.android.gms.gcm.Task;
|
| @@ -52,16 +50,15 @@ public class SnippetsLauncher {
|
|
|
| /**
|
| * Create a SnippetsLauncher object, which is owned by C++.
|
| - * @param context The app context.
|
| */
|
| @VisibleForTesting
|
| @CalledByNative
|
| - public static SnippetsLauncher create(Context context) {
|
| + public static SnippetsLauncher create() {
|
| if (sInstance != null) {
|
| throw new IllegalStateException("Already instantiated");
|
| }
|
|
|
| - sInstance = new SnippetsLauncher(context);
|
| + sInstance = new SnippetsLauncher();
|
| return sInstance;
|
| }
|
|
|
| @@ -84,19 +81,19 @@ public class SnippetsLauncher {
|
| return sInstance != null;
|
| }
|
|
|
| - protected SnippetsLauncher(Context context) {
|
| - checkGCM(context);
|
| - mScheduler = GcmNetworkManager.getInstance(context);
|
| + protected SnippetsLauncher() {
|
| + checkGCM();
|
| + mScheduler = GcmNetworkManager.getInstance(ContextUtils.getApplicationContext());
|
| }
|
|
|
| - private boolean canUseGooglePlayServices(Context context) {
|
| + private boolean canUseGooglePlayServices() {
|
| return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
|
| - context, new UserRecoverableErrorHandler.Silent());
|
| + ContextUtils.getApplicationContext(), new UserRecoverableErrorHandler.Silent());
|
| }
|
|
|
| - private void checkGCM(Context context) {
|
| + private void checkGCM() {
|
| // Check to see if Play Services is up to date, and disable GCM if not.
|
| - if (!canUseGooglePlayServices(context)) {
|
| + if (!canUseGooglePlayServices()) {
|
| mGCMEnabled = false;
|
| Log.i(TAG, "Disabling SnippetsLauncher because Play Services is not up to date.");
|
| }
|
|
|