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


Java ProfileSyncService类代码示例

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


ProfileSyncService类属于org.chromium.chrome.browser.sync包,在下文中一共展示了ProfileSyncService类的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: configureSyncSettings

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
private void configureSyncSettings() {
    final Preferences preferences = (Preferences) getActivity();
    final Account account = ChromeSigninController.get(getActivity()).getSignedInUser();
    findPreference(PREF_SYNC_SETTINGS)
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    if (!isVisible() || !isResumed()) return false;

                    if (ProfileSyncService.get() == null) return true;

                    Bundle args = new Bundle();
                    args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name);
                    preferences.startFragment(SyncCustomizationFragment.class.getName(), args);

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

示例3: 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

示例4: onResume

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Account account = ChromeSigninController.get(this).getSignedInUser();
    if (account == null) {
        finish();
        return;
    }

    if (!isShowingDialog(FRAGMENT_PASSPHRASE)) {
        if (ProfileSyncService.get().isBackendInitialized()) {
            displayPassphraseDialog();
        } else {
            addSyncStateChangedListener();
            displaySpinnerDialog();
        }
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:PassphraseActivity.java

示例5: 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

示例6: 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

示例7: updateEnabled

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
/**
 * If precaching is enabled, then allow the PrecacheService to be launched and signal Chrome
 * when conditions are right to start precaching. If precaching is disabled, prevent the
 * PrecacheService from ever starting.
 *
 * @param context Any context within the application.
 */
@VisibleForTesting
void updateEnabled(final Context context) {
    Log.v(TAG, "updateEnabled starting");
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            final ProfileSyncService sync = ProfileSyncService.get();

            if (mListener == null) {
                mListener = new ProfileSyncService.SyncStateChangedListener() {
                    public void syncStateChanged() {
                        if (sync.isSyncInitialized()) {
                            updateEnabledSync(context);
                        }
                    }
                };
                sync.addSyncStateChangedListener(mListener);
            }

            // Call the listener once, in case the sync backend is already initialized.
            mListener.syncStateChanged();
            Log.v(TAG, "updateEnabled complete");
        }
    });
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:33,代码来源:PrecacheLauncher.java

示例8: signOut

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
/**
 * Signs out of Chrome.
 * <p/>
 * This method clears the signed-in username, stops sync and sends out a
 * sign-out notification on the native side.
 *
 * @param activity If not null then a progress dialog is shown over the activity until signout
 * completes, in case the account had management enabled. The activity must be valid until the
 * callback is invoked.
 * @param callback Will be invoked after signout completes, if not null.
 */
public void signOut(Activity activity, Runnable callback) {
    mSignOutCallback = callback;

    boolean wipeData = getManagementDomain() != null;
    Log.d(TAG, "Signing out, wipe data? " + wipeData);

    ChromeSigninController.get(mContext).clearSignedInUser();
    ProfileSyncService.get().signOut();
    nativeSignOut(mNativeSigninManagerAndroid);

    if (wipeData) {
        wipeProfileData(activity);
    } else {
        onSignOutDone();
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:28,代码来源:SigninManager.java

示例9: onResume

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Account account = ChromeSigninController.get(this).getSignedInUser();
    if (account == null) {
        finish();
        return;
    }

    if (!isShowingDialog(FRAGMENT_PASSPHRASE)) {
        if (ProfileSyncService.get().isSyncInitialized()) {
            displayPassphraseDialog();
        } else {
            addSyncStateChangedListener();
            displaySpinnerDialog();
        }
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:19,代码来源:PassphraseActivity.java

示例10: 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() {
    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(ProfileSyncService.get().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.class);
    mContext.startService(registerIntent);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:29,代码来源:InvalidationController.java

示例11: 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

示例12: configureSyncSettings

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
private void configureSyncSettings() {
    final Preferences preferences = (Preferences) getActivity();
    findPreference(PREF_SYNC_SETTINGS)
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    if (!isVisible() || !isResumed()) return false;

                    if (ProfileSyncService.get() == null) return true;

                    Bundle args = new Bundle();
                    args.putString(
                            SyncCustomizationFragment.ARGUMENT_ACCOUNT, mSignedInAccountName);
                    preferences.startFragment(SyncCustomizationFragment.class.getName(), args);

                    return true;
                }
            });
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:AccountManagementFragment.java

示例13: onResume

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    Account account = ChromeSigninController.get().getSignedInUser();
    if (account == null) {
        finish();
        return;
    }

    if (!isShowingDialog(FRAGMENT_PASSPHRASE)) {
        if (ProfileSyncService.get().isEngineInitialized()) {
            displayPassphraseDialog();
        } else {
            addSyncStateChangedListener();
            displaySpinnerDialog();
        }
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:PassphraseActivity.java

示例14: signOut

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
/**
 * Signs out of Chrome.
 * <p/>
 * This method clears the signed-in username, stops sync and sends out a
 * sign-out notification on the native side.
 *
 * @param activity If not null then a progress dialog is shown over the activity until signout
 * completes, in case the account had management enabled. The activity must be valid until the
 * callback is invoked.
 * @param callback Will be invoked after signout completes, if not null.
 */
public void signOut(Activity activity, Runnable callback) {
    mSignOutCallback = callback;

    boolean wipeData = getManagementDomain() != null;
    Log.d(TAG, "Signing out, wipe data? " + wipeData);

    ChromeSigninController.get(mContext).clearSignedInUser();
    ProfileSyncService.get(mContext).signOut();
    nativeSignOut(mNativeSigninManagerAndroid);

    if (wipeData) {
        wipeProfileData(activity);
    } else {
        onSignOutDone();
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:28,代码来源:SigninManager.java

示例15: updateEnabled

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
/**
 * If precaching is enabled, then allow the PrecacheController to be launched and signal Chrome
 * when conditions are right to start precaching. If precaching is disabled, prevent the
 * PrecacheController from ever starting.
 *
 * @param context any context within the application
 */
@VisibleForTesting
void updateEnabled(final Context context) {
    Log.v(TAG, "updateEnabled starting");
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            mCalled = true;
            final ProfileSyncService sync = ProfileSyncService.get();

            if (mListener == null && sync != null) {
                mListener = new ProfileSyncService.SyncStateChangedListener() {
                    public void syncStateChanged() {
                        if (sync.isBackendInitialized()) {
                            mSyncInitialized = true;
                            updateEnabledSync(context);
                        }
                    }
                };
                sync.addSyncStateChangedListener(mListener);
            }

            if (mListener != null) {
                // Call the listener once, in case the sync backend is already initialized.
                mListener.syncStateChanged();
            }
            Log.v(TAG, "updateEnabled complete");
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:37,代码来源:PrecacheLauncher.java


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