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

Unified Diff: sync/android/java/src/org/chromium/sync/notifier/SyncStatusHelper.java

Issue 12388057: Android: Use ObserverList to maintain a list of observers/listeners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix findbugs and Ted's comments Created 7 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
« no previous file with comments | « net/android/java/src/org/chromium/net/NetworkChangeNotifier.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/android/java/src/org/chromium/sync/notifier/SyncStatusHelper.java
diff --git a/sync/android/java/src/org/chromium/sync/notifier/SyncStatusHelper.java b/sync/android/java/src/org/chromium/sync/notifier/SyncStatusHelper.java
index 4b42eb8d9aa52fa7dac8dc6067b3dce9c6673393..43c6fc7ed99b4ca85738a30a2d068e1da07d4b0b 100644
--- a/sync/android/java/src/org/chromium/sync/notifier/SyncStatusHelper.java
+++ b/sync/android/java/src/org/chromium/sync/notifier/SyncStatusHelper.java
@@ -14,12 +14,11 @@ import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.util.Log;
+import org.chromium.base.ObserverList;
import org.chromium.sync.signin.AccountManagerHelper;
import com.google.common.annotations.VisibleForTesting;
-import java.util.ArrayList;
-
/**
* A helper class to handle the current status of sync for Chrome in Android-land.
*
@@ -52,7 +51,7 @@ public class SyncStatusHelper {
private static SyncStatusHelper sSyncStatusHelper;
- private ArrayList<Listener> mListeners;
+ private ObserverList<Listener> mListeners;
/**
* @param context the context
@@ -62,7 +61,7 @@ public class SyncStatusHelper {
SyncContentResolverDelegate syncContentResolverWrapper) {
mApplicationContext = context.getApplicationContext();
mSyncContentResolverWrapper = syncContentResolverWrapper;
- mListeners = new ArrayList<Listener>();
+ mListeners = new ObserverList<Listener>();
}
/**
@@ -327,15 +326,14 @@ public class SyncStatusHelper {
* @param listener Listener to add.
*/
public void addListener(Listener listener) {
- mListeners.add(listener);
+ mListeners.addObserver(listener);
}
/**
* Removes a Listener.
* @param listener Listener to remove from the list.
- * @returns whether or not the Listener was removed.
*/
- public boolean removeListener(Listener listener) {
- return mListeners.remove(listener);
+ public void removeListener(Listener listener) {
+ mListeners.removeObserver(listener);
}
}
« no previous file with comments | « net/android/java/src/org/chromium/net/NetworkChangeNotifier.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698