当前位置: 首页>>代码示例>>Java>>正文


Java ProfileSyncService.get方法代码示例

本文整理汇总了Java中org.chromium.chrome.browser.sync.ProfileSyncService.get方法的典型用法代码示例。如果您正苦于以下问题:Java ProfileSyncService.get方法的具体用法?Java ProfileSyncService.get怎么用?Java ProfileSyncService.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.chrome.browser.sync.ProfileSyncService的用法示例。


在下文中一共展示了ProfileSyncService.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@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());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:AccountManagementFragment.java

示例2: showSyncErrorIcon

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
 * Checks if sync error icon should be shown. Show sync error icon if sync is off because
 * of error, passphrase required or disabled in Android.
 */
static boolean showSyncErrorIcon(Context context) {
    if (!AndroidSyncSettings.isMasterSyncEnabled(context)) {
        return true;
    }

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    if (profileSyncService != null) {
        if (profileSyncService.hasUnrecoverableError()) {
            return true;
        }

        if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
            return true;
        }

        if (profileSyncService.isSyncActive()
                && profileSyncService.isPassphraseRequiredForDecryption()) {
            return true;
        }
    }

    return false;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:28,代码来源:SyncPreference.java

示例3: getPromptText

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
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();
            case IMPLICIT_PASSPHRASE: // Falling through intentionally.
            case KEYSTORE_PASSPHRASE: // Falling through intentionally.
            default:
                Log.w(TAG, "Found incorrect passphrase type " + passphraseType
                                + ". Falling back to default string.");
                return accountName + pss.getSyncEnterCustomPassphraseBodyText();
        }
    }
    return accountName + pss.getSyncEnterCustomPassphraseBodyText();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:21,代码来源:PassphraseDialogFragment.java

示例4: onStopWithNative

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onStopWithNative() {
    Tab tab = getActivityTab();
    if (tab != null && !hasWindowFocus()) tab.onActivityHidden();
    if (mAppMenuHandler != null) mAppMenuHandler.hideAppMenu();

    if (GSAState.getInstance(this).isGsaAvailable()) {
        GSAAccountChangeListener.getInstance().disconnect();
        if (mSyncStateChangedListener != null) {
            ProfileSyncService syncService = ProfileSyncService.get();
            if (syncService != null) {
                syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
            }
            mSyncStateChangedListener = null;
        }
    }
    super.onStopWithNative();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:ChromeActivity.java

示例5: onCreate

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@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);
    }

    mProfile = Profile.getLastUsedProfile();

    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.VIEW,
            mGaiaServiceType);

    startFetchingAccountsInformation(getActivity(), mProfile);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:26,代码来源:AccountManagementFragment.java

示例6: onResume

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    SigninManager.get(getActivity()).addSignInStateObserver(this);
    ProfileDownloader.addObserver(this);
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService != null) {
        syncService.addSyncStateChangedListener(this);
    }

    update();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:AccountManagementFragment.java

示例7: onPause

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onPause() {
    super.onPause();
    SigninManager.get(getActivity()).removeSignInStateObserver(this);
    ProfileDownloader.removeObserver(this);
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService != null) {
        syncService.removeSyncStateChangedListener(this);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:AccountManagementFragment.java

示例8: onDestroy

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
@Override
public void onDestroy() {
    super.onDestroy();

    // Allow sync to begin syncing if it hasn't yet.
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService != null) {
        syncService.setSetupInProgress(false);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:AccountManagementFragment.java

示例9: SigninHelper

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private SigninHelper(Context context) {
    mContext = context;
    mProfileSyncService = ProfileSyncService.get();
    mSigninManager = SigninManager.get(mContext);
    mAccountTrackerService = AccountTrackerService.get(mContext);
    mOAuth2TokenService = OAuth2TokenService.getForProfile(Profile.getLastUsedProfile());
    mChromeSigninController = ChromeSigninController.get(mContext);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:SigninHelper.java

示例10: registerForUpdates

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:SignInPreference.java

示例11: unregisterForUpdates

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:SignInPreference.java

示例12: ensureStartedAndUpdateRegisteredTypes

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
/**
 * Updates the sync invalidation types that the client is registered for based on the preferred
 * sync types.  Starts the client if needed.
 */
public void ensureStartedAndUpdateRegisteredTypes() {
    ProfileSyncService syncService = ProfileSyncService.get();
    if (syncService == null) return;

    mStarted = true;

    // Ensure GCM has been initialized.
    ensureGcmIsInitialized();

    // Do not apply changes to {@link #mSessionInvalidationsEnabled} yet because the timer task
    // may be scheduled far into the future.
    mEnableSessionInvalidationsTimer.resume();

    HashSet<Integer> typesToRegister = new HashSet<Integer>();
    typesToRegister.addAll(syncService.getPreferredDataTypes());
    if (!mSessionInvalidationsEnabled) {
        typesToRegister.remove(ModelType.SESSIONS);
        typesToRegister.remove(ModelType.FAVICON_TRACKING);
        typesToRegister.remove(ModelType.FAVICON_IMAGES);
    }

    Intent registerIntent = InvalidationIntentProtocol.createRegisterIntent(
            ChromeSigninController.get(mContext).getSignedInUser(),
            typesToRegister);
    registerIntent.setClass(
            mContext, InvalidationClientService.getRegisteredClass());
    mContext.startService(registerIntent);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:InvalidationController.java

示例13: finishSignIn

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private void finishSignIn(AccountIdsAndNames accountIdsAndNames) {
    if (mSignInAccount == null) {
        Log.w(TAG, "Sign in request was canceled; aborting finishSignIn().");
        return;
    }

    // Tell the native side that sign-in has completed.
    nativeOnSignInCompleted(mNativeSigninManagerAndroid, mSignInAccount.name,
                            accountIdsAndNames.mAccountIds, accountIdsAndNames.mAccountNames);

    // Cache the signed-in account name. This must be done after the native call, otherwise
    // sync tries to start without being signed in natively and crashes.
    ChromeSigninController.get(mContext).setSignedInAccountName(mSignInAccount.name);

    // Sign-in to sync.
    ProfileSyncService profileSyncService = ProfileSyncService.get();
    if (AndroidSyncSettings.isSyncEnabled(mContext)
            && !profileSyncService.hasSyncSetupCompleted()) {
        profileSyncService.setSetupInProgress(true);
        profileSyncService.requestStart();
    }

    if (mSignInFlowObserver != null) mSignInFlowObserver.onSigninComplete();

    // All done, cleanup.
    Log.d(TAG, "Signin done");
    mSignInActivity = null;
    mSignInAccount = null;
    mSignInFlowObserver = null;

    notifySignInAllowedChanged();
    for (SignInStateObserver observer : mSignInStateObservers) {
        observer.onSignedIn();
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:36,代码来源:SigninManager.java

示例14: getSyncStatusSummary

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private static String getSyncStatusSummary(Activity activity) {
    if (!ChromeSigninController.get(activity).isSignedIn()) return "";

    ProfileSyncService profileSyncService = ProfileSyncService.get();
    Resources res = activity.getResources();

    if (ChildAccountService.getInstance(activity).hasChildAccount()) {
        return res.getString(R.string.kids_account);
    }

    if (!AndroidSyncSettings.isMasterSyncEnabled(activity)) {
        return res.getString(R.string.sync_android_master_sync_disabled);
    }

    if (profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) {
        return res.getString(profileSyncService.getAuthError().getMessage());
    }

    if (AndroidSyncSettings.isSyncEnabled(activity)) {
        if (!profileSyncService.isSyncInitialized()) {
            return res.getString(R.string.sync_setup_progress);
        }

        if (profileSyncService.isPassphraseRequiredForDecryption()) {
            return res.getString(R.string.sync_need_passphrase);
        }
    }

    return AndroidSyncSettings.isSyncEnabled(activity)
            ? res.getString(R.string.sync_is_enabled)
            : res.getString(R.string.sync_is_disabled);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:33,代码来源:AccountManagementFragment.java

示例15: SigninHelper

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入方法依赖的package包/类
private SigninHelper(Context context) {
    mContext = context;
    mProfileSyncService = ProfileSyncService.get();
    mSigninManager = SigninManager.get(mContext);
    mOAuth2TokenService = OAuth2TokenService.getForProfile(Profile.getLastUsedProfile());
    mSyncController = SyncController.get(context);
    mChromeSigninController = ChromeSigninController.get(mContext);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:9,代码来源:SigninHelper.java


注:本文中的org.chromium.chrome.browser.sync.ProfileSyncService.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。