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


Java ChromeSigninController.get方法代码示例

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


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

示例1: GoogleServicesManager

import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private GoogleServicesManager(Context context) {
    try {
        TraceEvent.begin("GoogleServicesManager.GoogleServicesManager");
        ThreadUtils.assertOnUiThread();
        // We should store the application context, as we outlive any activity which may create
        // us.
        mContext = context.getApplicationContext();

        mChromeSigninController = ChromeSigninController.get(mContext);
        mSigninHelper = SigninHelper.get(mContext);

        // The sign out flow starts by clearing the signed in user in the ChromeSigninController
        // on the Java side, and then performs a sign out on the native side. If there is a
        // crash on the native side then the signin state may get out of sync. Make sure that
        // the native side is signed out if the Java side doesn't have a currently signed in
        // user.
        SigninManager signinManager = SigninManager.get(mContext);
        if (!mChromeSigninController.isSignedIn() && signinManager.isSignedInOnNative()) {
            Log.w(TAG, "Signed in state got out of sync, forcing native sign out");
            signinManager.signOut(null, null);
        }

        // Initialize sync.
        SyncController.get(context);

        ApplicationStatus.registerApplicationStateListener(this);
    } finally {
        TraceEvent.end("GoogleServicesManager.GoogleServicesManager");
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:31,代码来源:GoogleServicesManager.java

示例2: update

import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
public void update() {
    final Context context = getActivity();
    if (context == null) return;

    if (getPreferenceScreen() != null) getPreferenceScreen().removeAll();

    ChromeSigninController signInController = ChromeSigninController.get(context);
    if (!signInController.isSignedIn()) {
        // The AccountManagementFragment can only be shown when the user is signed in. If the
        // user is signed out, exit the fragment.
        getActivity().finish();
        return;
    }

    addPreferencesFromResource(R.xml.account_management_preferences);

    String signedInAccountName =
            ChromeSigninController.get(getActivity()).getSignedInAccountName();
    String fullName = getCachedUserName(signedInAccountName);
    if (TextUtils.isEmpty(fullName)) {
        fullName = ProfileDownloader.getCachedFullName(Profile.getLastUsedProfile());
    }
    if (TextUtils.isEmpty(fullName)) fullName = signedInAccountName;

    getActivity().setTitle(fullName);

    configureSignOutSwitch();
    configureAddAccountPreference(fullName);
    configureGoIncognitoPreferences(fullName);
    configureChildAccountPreferences();

    updateAccountsList();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:34,代码来源:AccountManagementFragment.java

示例3: SigninHelper

import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的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

示例4: SyncController

import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private SyncController(Context context) {
    mContext = context;
    mChromeSigninController = ChromeSigninController.get(mContext);
    AndroidSyncSettings.registerObserver(context, this);
    mProfileSyncService = ProfileSyncService.get();
    mProfileSyncService.addSyncStateChangedListener(this);

    // Set the sessions ID using the generator that was registered for GENERATOR_ID.
    mProfileSyncService.setSessionsId(
            UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID));

    // Create the SyncNotificationController.
    mSyncNotificationController = new SyncNotificationController(
            mContext, PassphraseActivity.class, AccountManagementFragment.class);
    mProfileSyncService.addSyncStateChangedListener(mSyncNotificationController);

    updateSyncStateFromAndroid();

    // When the application gets paused, tell sync to flush the directory to disk.
    ApplicationStatus.registerStateListenerForAllActivities(new ActivityStateListener() {
        @Override
        public void onActivityStateChange(Activity activity, int newState) {
            if (newState == ActivityState.PAUSED) {
                mProfileSyncService.flushDirectory();
            }
        }
    });
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:29,代码来源:SyncController.java

示例5: SyncController

import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
private SyncController(Context context) {
    mContext = context;
    mChromeSigninController = ChromeSigninController.get(mContext);
    mSyncStatusHelper = SyncStatusHelper.get(context);
    mSyncStatusHelper.registerSyncSettingsChangedObserver(this);
    mProfileSyncService = ProfileSyncService.get(mContext);
    mProfileSyncService.addSyncStateChangedListener(this);

    setupSessionSyncId();
    mChromeSigninController.ensureGcmIsInitialized();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:SyncController.java

示例6: update

import org.chromium.sync.signin.ChromeSigninController; //导入方法依赖的package包/类
/**
 * Updates the title, summary, and image based on the current sign-in state.
 */
private void update() {
    String title;
    String summary;
    String fragment;

    Account account = ChromeSigninController.get(getContext()).getSignedInUser();
    if (account == null) {
        title = getContext().getString(R.string.sign_in_to_chrome);
        summary = getContext().getString(R.string.sign_in_to_chrome_summary);
        fragment = null;
    } else {
        List<String> accounts = AccountManagerHelper.get(getContext()).getGoogleAccountNames();
        if (accounts.size() == 1) {
            summary = accounts.get(0);
        } else {
            summary = getContext().getString(
                    R.string.number_of_signed_in_accounts, accounts.size());
        }
        fragment = AccountManagementFragment.class.getName();
        title = AccountManagementFragment.getCachedUserName(account.name);
        if (title == null) {
            final Profile profile = Profile.getLastUsedProfile();
            String cachedName = ProfileDownloader.getCachedFullName(profile);
            Bitmap cachedBitmap = ProfileDownloader.getCachedAvatar(profile);
            if (TextUtils.isEmpty(cachedName) || cachedBitmap == null) {
                AccountManagementFragment.startFetchingAccountInformation(
                        getContext(), profile, account.name);
            }
            title = TextUtils.isEmpty(cachedName) ? account.name : cachedName;
        }
    }

    setTitle(title);
    setSummary(summary);
    setFragment(fragment);

    ChromeSigninController signinController = ChromeSigninController.get(getContext());
    boolean enabled = signinController.isSignedIn()
            || SigninManager.get(getContext()).isSignInAllowed();
    if (mViewEnabled != enabled) {
        mViewEnabled = enabled;
        notifyChanged();
    }
    if (!enabled) setFragment(null);

    if (SigninManager.get(getContext()).isSigninDisabledByPolicy()) {
        setIcon(ManagedPreferencesUtils.getManagedByEnterpriseIconId());
    } else {
        Resources resources = getContext().getResources();
        Bitmap bitmap = AccountManagementFragment.getUserPicture(
                signinController.getSignedInAccountName(), resources);
        setIcon(new BitmapDrawable(resources, bitmap));
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:58,代码来源:SignInPreference.java


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