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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.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/BackgroundSyncLauncher.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java
index 4bbbb4cdf1ec392afee4fa90a27ea82ddd26765b..dc6d9508b4bac5f25ddad3b5537adc7e73b9b463 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java
@@ -55,16 +55,15 @@ public class BackgroundSyncLauncher {
/**
* Create a BackgroundSyncLauncher object, which is owned by C++.
- * @param context The app context.
*/
@VisibleForTesting
@CalledByNative
- protected static BackgroundSyncLauncher create(Context context) {
+ protected static BackgroundSyncLauncher create() {
if (sInstance != null) {
throw new IllegalStateException("Already instantiated");
}
- sInstance = new BackgroundSyncLauncher(context);
+ sInstance = new BackgroundSyncLauncher();
return sInstance;
}
@@ -159,14 +158,14 @@ public class BackgroundSyncLauncher {
return sInstance != null;
}
- protected BackgroundSyncLauncher(Context context) {
- mScheduler = GcmNetworkManager.getInstance(context);
+ protected BackgroundSyncLauncher() {
+ mScheduler = GcmNetworkManager.getInstance(ContextUtils.getApplicationContext());
launchBrowserIfStopped(false, 0);
}
- private static boolean canUseGooglePlayServices(Context context) {
+ private static boolean canUseGooglePlayServices() {
return ExternalAuthUtils.getInstance().canUseGooglePlayServices(
- context, new UserRecoverableErrorHandler.Silent());
+ ContextUtils.getApplicationContext(), new UserRecoverableErrorHandler.Silent());
}
/**
@@ -175,16 +174,15 @@ public class BackgroundSyncLauncher {
* which fail cannot be reregistered. Better to wait until Play Services is updated before
* attempting them.
*
- * @param context The application context.
*/
@CalledByNative
- private static boolean shouldDisableBackgroundSync(Context context) {
+ private static boolean shouldDisableBackgroundSync() {
// Check to see if Play Services is up to date, and disable GCM if not.
// This will not automatically set {@link sGCMEnabled} to true, in case it has been
// disabled in tests.
if (sGCMEnabled) {
boolean isAvailable = true;
- if (!canUseGooglePlayServices(context)) {
+ if (!canUseGooglePlayServices()) {
setGCMEnabled(false);
Log.i(TAG, "Disabling Background Sync because Play Services is not up to date.");
isAvailable = false;

Powered by Google App Engine
This is Rietveld 408576698