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();
}
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());
}
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);
}
}
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);
}
}
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();
}
Aggregations