use of org.chromium.chrome.browser.sync.SyncController in project AndroidChromium by JackyAndroid.
the class ChromeActivity method createContextReporterIfNeeded.
private void createContextReporterIfNeeded() {
if (mContextReporter != null || getActivityTab() == null)
return;
final SyncController syncController = SyncController.get(this);
final ProfileSyncService syncService = ProfileSyncService.get();
if (syncController != null && syncController.isSyncingUrlsWithKeystorePassphrase()) {
assert syncService != null;
mContextReporter = ((ChromeApplication) getApplicationContext()).createGsaHelper().getContextReporter(this);
if (mSyncStateChangedListener != null) {
syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
mSyncStateChangedListener = null;
}
return;
} else {
ContextReporter.reportSyncStatus(syncService);
}
if (mSyncStateChangedListener == null && syncService != null) {
mSyncStateChangedListener = new ProfileSyncService.SyncStateChangedListener() {
@Override
public void syncStateChanged() {
createContextReporterIfNeeded();
}
};
syncService.addSyncStateChangedListener(mSyncStateChangedListener);
}
}
Aggregations