• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ProfileSyncService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ProfileSyncService类属于org.chromium.chrome.browser.sync包,在下文中一共展示了ProfileSyncService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


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


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


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


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


示例20: reportSyncStatus

import org.chromium.chrome.browser.sync.ProfileSyncService; //导入依赖的package包/类
/**
 * Records an appropriate status via UMA given the current sync status.
 */
public static void reportSyncStatus(@Nullable ProfileSyncService syncService) {
    if (syncService == null || !syncService.isBackendInitialized()) {
        reportStatus(STATUS_SYNC_NOT_INITIALIZED);
    } else if (!syncService.getActiveDataTypes().contains(ModelType.TYPED_URLS)) {
        reportStatus(STATUS_SYNC_NOT_SYNCING_URLS);
    } else if (!syncService.getPassphraseType().equals(PassphraseType.KEYSTORE_PASSPHRASE)) {
        reportStatus(STATUS_SYNC_NOT_KEYSTORE_PASSPHRASE);
    } else {
        reportStatus(STATUS_SYNC_OTHER);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:ContextReporter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Operations类代码示例发布时间:2022-05-22
下一篇:
Java RMAppFailedAttemptEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap