Index: sync/android/java/src/org/chromium/sync/notifier/InvalidationController.java |
diff --git a/sync/android/java/src/org/chromium/sync/notifier/InvalidationController.java b/sync/android/java/src/org/chromium/sync/notifier/InvalidationController.java |
index cd98293b562c46ad9ec89aad1eeec50c57384f4f..aa6b3d3838b4690b19e598d02e9c439337abfad2 100644 |
--- a/sync/android/java/src/org/chromium/sync/notifier/InvalidationController.java |
+++ b/sync/android/java/src/org/chromium/sync/notifier/InvalidationController.java |
@@ -119,7 +119,9 @@ public class InvalidationController implements ActivityStatus.StateListener { |
* @param types Set of types for which to register. Ignored if {@code allTypes == true}. |
*/ |
public void setRegisteredTypes(Account account, boolean allTypes, Set<ModelType> types) { |
- Set<ModelType> typesToRegister = getModelTypeResolver().resolveModelTypes(types); |
+ Set<ModelType> typesToRegister = types; |
+ // Proxy types should never receive notifications. |
+ typesToRegister.remove(ModelType.PROXY_TABS); |
Intent registerIntent = IntentProtocol.createRegisterIntent(account, allTypes, |
typesToRegister); |
setDestinationClassName(registerIntent); |
@@ -132,6 +134,7 @@ public class InvalidationController implements ActivityStatus.StateListener { |
* values. It can be used on startup of Chrome to ensure we always have a consistent set of |
* registrations. |
*/ |
+ @Deprecated |
public void refreshRegisteredTypes() { |
InvalidationPreferences invalidationPreferences = new InvalidationPreferences(mContext); |
Set<String> savedSyncedTypes = invalidationPreferences.getSavedSyncedTypes(); |
@@ -144,6 +147,22 @@ public class InvalidationController implements ActivityStatus.StateListener { |
} |
/** |
+ * Reads all stored preferences and calls |
+ * {@link #setRegisteredTypes(android.accounts.Account, boolean, java.util.Set)} with the stored |
+ * values, refreshing the set of types with {@code types}. It can be used on startup of Chrome |
+ * to ensure we always have a set of registrations consistent with the native code. |
+ * @param types Set of types for which to register. |
+ */ |
+ public void refreshRegisteredTypes(Set<ModelType> types) { |
+ InvalidationPreferences invalidationPreferences = new InvalidationPreferences(mContext); |
+ Set<String> savedSyncedTypes = invalidationPreferences.getSavedSyncedTypes(); |
+ Account account = invalidationPreferences.getSavedSyncedAccount(); |
+ boolean allTypes = savedSyncedTypes != null && |
+ savedSyncedTypes.contains(ModelType.ALL_TYPES_TYPE); |
+ setRegisteredTypes(account, allTypes, types); |
+ } |
+ |
+ /** |
* Starts the invalidation client. |
*/ |
public void start() { |
@@ -240,11 +259,6 @@ public class InvalidationController implements ActivityStatus.StateListener { |
return null; |
} |
- @VisibleForTesting |
- ModelTypeResolver getModelTypeResolver() { |
- return new ModelTypeResolverImpl(); |
- } |
- |
@Override |
public void onActivityStateChange(int newState) { |
if (SyncStatusHelper.get(mContext).isSyncEnabled()) { |