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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java

Issue 159173002: Refactor ActivityStatus to not store current activity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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/invalidation/InvalidationController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java b/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java
index d9b566713aead4f816ef98e1691ac52eba84092c..8e3cac34a841f81c5c37116e3ee967ea96494b1a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java
@@ -11,7 +11,8 @@ import android.content.Intent;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
-import org.chromium.base.ActivityStatus;
+import org.chromium.base.ApplicationState;
+import org.chromium.base.ApplicationStatus;
import org.chromium.base.CalledByNative;
import org.chromium.sync.internal_api.pub.base.ModelType;
import org.chromium.sync.notifier.InvalidationClientNameProvider;
@@ -26,7 +27,7 @@ import java.util.Set;
* Controller used to send start, stop, and registration-change commands to the invalidation
* client library used by Sync.
*/
-public class InvalidationController implements ActivityStatus.StateListener {
+public class InvalidationController implements ApplicationStatus.ApplicationStateListener {
private static final Object LOCK = new Object();
private static InvalidationController sInstance;
@@ -119,16 +120,16 @@ public class InvalidationController implements ActivityStatus.StateListener {
@VisibleForTesting
InvalidationController(Context context) {
mContext = Preconditions.checkNotNull(context.getApplicationContext());
- ActivityStatus.registerStateListener(this);
+ ApplicationStatus.registerApplicationStateListener(this);
}
@Override
- public void onActivityStateChange(int newState) {
+ public void onApplicationStateChange(int newState) {
if (SyncStatusHelper.get(mContext).isSyncEnabled()) {
- if (newState == ActivityStatus.PAUSED) {
- stop();
- } else if (newState == ActivityStatus.RESUMED) {
+ if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) {
start();
+ } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) {
+ stop();
}
}
}

Powered by Google App Engine
This is Rietveld 408576698