Search in sources :

Example 1 with ProfileSyncService

use of org.chromium.chrome.browser.sync.ProfileSyncService in project AndroidChromium by JackyAndroid.

the class ChromeActivity method onStopWithNative.

@Override
public void onStopWithNative() {
    Tab tab = getActivityTab();
    if (tab != null && !hasWindowFocus())
        tab.onActivityHidden();
    if (mAppMenuHandler != null)
        mAppMenuHandler.hideAppMenu();
    if (mGSAServiceClient != null) {
        mGSAServiceClient.disconnect();
        mGSAServiceClient = null;
        if (mSyncStateChangedListener != null) {
            ProfileSyncService syncService = ProfileSyncService.get();
            if (syncService != null) {
                syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
            }
            mSyncStateChangedListener = null;
        }
    }
    super.onStopWithNative();
}
Also used : ProfileSyncService(org.chromium.chrome.browser.sync.ProfileSyncService) Tab(org.chromium.chrome.browser.tab.Tab)

Example 2 with ProfileSyncService

use of org.chromium.chrome.browser.sync.ProfileSyncService in project AndroidChromium by JackyAndroid.

the class AccountManagementFragment method onCreate.

@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    // Prevent sync from starting if it hasn't already to give the user a chance to change
    // their sync settings.
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService != null) {
        syncService.setSetupInProgress(true);
    }
    mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE;
    if (getArguments() != null) {
        mGaiaServiceType = getArguments().getInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
    }
    AccountManagementScreenHelper.logEvent(ProfileAccountManagementMetrics.VIEW, mGaiaServiceType);
    startFetchingAccountsInformation(getActivity(), Profile.getLastUsedProfile());
}
Also used : ProfileSyncService(org.chromium.chrome.browser.sync.ProfileSyncService)

Example 3 with ProfileSyncService

use of org.chromium.chrome.browser.sync.ProfileSyncService in project AndroidChromium by JackyAndroid.

the class SignInPreference method unregisterForUpdates.

/**
     * Stops listening for updates to the sign-in and sync state. Every call to registerForUpdates()
     * must be matched with a call to this method.
     */
public void unregisterForUpdates() {
    SigninManager manager = SigninManager.get(getContext());
    manager.removeSignInAllowedObserver(this);
    ProfileDownloader.removeObserver(this);
    AndroidSyncSettings.unregisterObserver(getContext(), this);
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService != null) {
        syncService.removeSyncStateChangedListener(this);
    }
}
Also used : ProfileSyncService(org.chromium.chrome.browser.sync.ProfileSyncService) SigninManager(org.chromium.chrome.browser.signin.SigninManager)

Example 4 with ProfileSyncService

use of org.chromium.chrome.browser.sync.ProfileSyncService in project AndroidChromium by JackyAndroid.

the class SignInPreference method registerForUpdates.

/**
     * Starts listening for updates to the sign-in and sync state.
     */
public void registerForUpdates() {
    SigninManager manager = SigninManager.get(getContext());
    manager.addSignInAllowedObserver(this);
    ProfileDownloader.addObserver(this);
    FirstRunSignInProcessor.updateSigninManagerFirstRunCheckDone(getContext());
    AndroidSyncSettings.registerObserver(getContext(), this);
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService != null) {
        syncService.addSyncStateChangedListener(this);
    }
}
Also used : ProfileSyncService(org.chromium.chrome.browser.sync.ProfileSyncService) SigninManager(org.chromium.chrome.browser.signin.SigninManager)

Example 5 with ProfileSyncService

use of org.chromium.chrome.browser.sync.ProfileSyncService in project AndroidChromium by JackyAndroid.

the class PassphraseDialogFragment method getPromptText.

private String getPromptText() {
    ProfileSyncService pss = ProfileSyncService.get();
    String accountName = pss.getCurrentSignedInAccountText() + "\n\n";
    PassphraseType passphraseType = pss.getPassphraseType();
    if (pss.hasExplicitPassphraseTime()) {
        switch(passphraseType) {
            case FROZEN_IMPLICIT_PASSPHRASE:
                return accountName + pss.getSyncEnterGooglePassphraseBodyWithDateText();
            case CUSTOM_PASSPHRASE:
                return accountName + pss.getSyncEnterCustomPassphraseBodyWithDateText();
            // Falling through intentionally.
            case IMPLICIT_PASSPHRASE:
            // Falling through intentionally.
            case KEYSTORE_PASSPHRASE:
            default:
                Log.w(TAG, "Found incorrect passphrase type " + passphraseType + ". Falling back to default string.");
                return accountName + pss.getSyncEnterCustomPassphraseBodyText();
        }
    }
    return accountName + pss.getSyncEnterCustomPassphraseBodyText();
}
Also used : ProfileSyncService(org.chromium.chrome.browser.sync.ProfileSyncService) PassphraseType(org.chromium.components.sync.PassphraseType) SpannableString(android.text.SpannableString)

Aggregations

ProfileSyncService (org.chromium.chrome.browser.sync.ProfileSyncService)12 SigninManager (org.chromium.chrome.browser.signin.SigninManager)2 Account (android.accounts.Account)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 Preference (android.preference.Preference)1 SpannableString (android.text.SpannableString)1 HashSet (java.util.HashSet)1 SavePasswordsPreferences (org.chromium.chrome.browser.preferences.password.SavePasswordsPreferences)1 SyncController (org.chromium.chrome.browser.sync.SyncController)1 Tab (org.chromium.chrome.browser.tab.Tab)1 PassphraseType (org.chromium.components.sync.PassphraseType)1