Search in sources :

Example 1 with SyncController

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);
    }
}
Also used : ProfileSyncService(org.chromium.chrome.browser.sync.ProfileSyncService) SyncController(org.chromium.chrome.browser.sync.SyncController)

Aggregations

ProfileSyncService (org.chromium.chrome.browser.sync.ProfileSyncService)1 SyncController (org.chromium.chrome.browser.sync.SyncController)1