Commit f9edd969 authored by Victor Hugo Vianna Silva's avatar Victor Hugo Vianna Silva Committed by Commit Bot

Refactor: Inline AndroidSyncSettingsChangedObserver with anonymous class

This class was used in a single place (to observe auto-sync settings via
Android APIs), its name was very similar to the exposed
AndroidSyncSettingsObserver interface, and its documentation was wrong
(it treated it as AndroidSyncSettingsObserver). The CL removes the class
and uses an anonymous class instead.

Bug: None
Change-Id: I73af1acf74b90d50e7412a50b1097668a1cfe17d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2403462Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/heads/master@{#805733}
parent 0acadcc3
...@@ -118,8 +118,18 @@ public class AndroidSyncSettings { ...@@ -118,8 +118,18 @@ public class AndroidSyncSettings {
updateSyncability(callback); updateSyncability(callback);
mSyncContentResolverDelegate.addStatusChangeListener( mSyncContentResolverDelegate.addStatusChangeListener(
ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, new SyncStatusObserver() {
new AndroidSyncSettingsChangedObserver()); @Override
public void onStatusChanged(int which) {
if (which == ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS) {
// Sync settings have changed; update our cached values.
if (updateCachedSettings()) {
// If something actually changed, tell our observers.
notifyObservers();
}
}
}
});
} }
/** /**
...@@ -286,24 +296,6 @@ public class AndroidSyncSettings { ...@@ -286,24 +296,6 @@ public class AndroidSyncSettings {
}); });
} }
/**
* Helper class to be used by observers whenever sync settings change.
*
* To register the observer, call AndroidSyncSettings.registerObserver(...).
*/
private class AndroidSyncSettingsChangedObserver implements SyncStatusObserver {
@Override
public void onStatusChanged(int which) {
if (which == ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS) {
// Sync settings have changed; update our cached values.
if (updateCachedSettings()) {
// If something actually changed, tell our observers.
notifyObservers();
}
}
}
}
/** /**
* Update the three cached settings from the content resolver. * Update the three cached settings from the content resolver.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment