Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.");
}

Powered by Google App Engine
This is Rietveld 408576698