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

Java SigninManager类代码示例

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

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



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

示例1: BookmarkPromoHeader

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Initializes the class. Note that this will start listening to signin related events and
 * update itself if needed.
 */
BookmarkPromoHeader(Context context,
        PromoHeaderShowingChangeListener showingChangeListener) {
    mContext = context;
    mShowingChangeListener = showingChangeListener;

    AndroidSyncSettings.registerObserver(mContext, this);

    mSignInManager = SigninManager.get(mContext);
    mSignInManager.addSignInStateObserver(this);

    updateShouldShow(false);
    if (shouldShow()) {
        int promoShowCount = ContextUtils.getAppSharedPreferences()
                .getInt(PREF_SIGNIN_PROMO_SHOW_COUNT, 0) + 1;
        ContextUtils.getAppSharedPreferences().edit()
                .putInt(PREF_SIGNIN_PROMO_SHOW_COUNT, promoShowCount).apply();
        RecordUserAction.record("Signin_Impression_FromBookmarkManager");
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:BookmarkPromoHeader.java


示例2: GoogleServicesManager

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的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();
        }

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

        ApplicationStatus.registerApplicationStateListener(this);
    } finally {
        TraceEvent.end("GoogleServicesManager.GoogleServicesManager");
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:31,代码来源:GoogleServicesManager.java


示例3: RecentTabsManager

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Create an RecentTabsManager to be used with RecentTabsPage and RecentTabsRowAdapter.
 *
 * @param tab The Tab that is showing this recent tabs page.
 * @param profile Profile that is associated with the current session.
 * @param context the Android context this manager will work in.
 */
public RecentTabsManager(Tab tab, Profile profile, Context context) {
    mProfile = profile;
    mTab = tab;
    mForeignSessionHelper = buildForeignSessionHelper(mProfile);
    mNewTabPagePrefs = buildNewTabPagePrefs(mProfile);
    mFaviconHelper = buildFaviconHelper();
    mRecentlyClosedBridge = buildRecentlyClosedBridge(mProfile);
    mSignInManager = SigninManager.get(context);
    mContext = context;

    updateRecentlyClosedTabs();
    registerForForeignSessionUpdates();
    updateForeignSessions();
    mForeignSessionHelper.triggerSessionSync();
    registerForSignInAndSyncNotifications();

    InvalidationController.get(mContext).onRecentTabsPageOpened();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:RecentTabsManager.java


示例4: onChildAccountStatusUpdated

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Called when the child account status has been determined or updated.
 * Can be overridden by subclasses to avoid native calls and calls into dependencies in testing.
 *
 * @param oldValue The old child account status. This is null when the child account status
 *         has been determined for the first time after the browser has started.
 */
protected void onChildAccountStatusUpdated(Boolean oldValue) {
    Log.v(TAG, "hasChildAccount: " + mHasChildAccount + " oldHasChildAccount: " + oldValue);
    if (mHasChildAccount) {
        if (oldValue == null) {
            // This is the first time we have determined the child account status, which means
            // the browser is starting up. If we are not signed in yet, the startup code will
            // sign in and call us back in onChildAccountSigninComplete().
            if (ChromeSigninController.get(mContext).getSignedInUser() == null) return;
        } else if (!oldValue.booleanValue()) {
            // We have switched from no child account to child account while the browser
            // is running. Sign in (which will call us back in onChildAccountSigninComplete()).
            SigninManager signinManager = SigninManager.get(mContext);
            Account account = AccountManagerHelper.get(mContext).getSingleGoogleAccount();
            signinManager.signInToSelectedAccount(null, account,
                    SigninManager.SIGNIN_TYPE_FORCED_CHILD_ACCOUNT,
                    SigninManager.SIGNIN_SYNC_IMMEDIATELY, false, null);
            return;
        }
    }
    // Fallthrough for all other cases: Propagate child account status to native code.
    // This is a no-op if the child account status does not change.
    nativeSetIsChildAccount(mHasChildAccount);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:31,代码来源:ChildAccountService.java


示例5: signIn

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Trigger Chromium sign in of the given account.
 *
 * This also ensure that sync setup is not in progress anymore, so sync will start after
 * sync initialization has happened.
 *
 * @param activity the current activity.
 * @param accountName the full account name.
 */
@VisibleForTesting
public void signIn(Activity activity, String accountName) {
    final Account account = AccountManagerHelper.createAccountFromName(accountName);

    // The SigninManager handles most of the sign-in flow, and doFinishSignIn handles the
    // ChromeShell specific details.
    SigninManager signinManager = SigninManager.get(mContext);
    signinManager.onFirstRunCheckDone();
    final boolean passive = false;
    signinManager.startSignIn(activity, account, passive, new SignInFlowObserver() {
        @Override
        public void onSigninComplete() {
            SigninManager.get(mContext).logInSignedInUser();
            mProfileSyncService.setSetupInProgress(false);
            start();
        }

        @Override
        public void onSigninCancelled() {
            stop();
        }
    });
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:33,代码来源:SyncController.java


示例6: onCreate

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        RecordUserAction.record("Stars_SignInPromoActivity_Launched");
    }

    setContentView(new RecentTabsPromoView(this, this, this));

    AndroidSyncSettings.registerObserver(this, this);

    mSignInManager = SigninManager.get(this);
    mSignInManager.addSignInStateObserver(this);

    // This signin activity shouldn't be created if user is signed in already, but for just in
    // case it was signed in just before onCreate somehow.
    if (isSignedIn()) finish();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:19,代码来源:EnhancedBookmarkSigninActivity.java


示例7: EnhancedBookmarkPromoHeader

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Initializes the class. Note that this will start listening to signin related events and
 * update itself if needed.
 */
EnhancedBookmarkPromoHeader(Context context,
        PromoHeaderShowingChangeListener showingChangeListener) {
    mContext = context;
    mShowingChangeListener = showingChangeListener;

    AndroidSyncSettings.registerObserver(mContext, this);

    mSignInManager = SigninManager.get(mContext);
    mSignInManager.addSignInStateObserver(this);

    updateShouldShow(false);
    if (shouldShow()) {
        int promoShowCount = PreferenceManager.getDefaultSharedPreferences(mContext)
                .getInt(PREF_SIGNIN_PROMO_SHOW_COUNT, 0) + 1;
        PreferenceManager.getDefaultSharedPreferences(mContext).edit()
                .putInt(PREF_SIGNIN_PROMO_SHOW_COUNT, promoShowCount).apply();
        RecordUserAction.record("Stars_SignInPromoHeader_Displayed");
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:24,代码来源:EnhancedBookmarkPromoHeader.java


示例8: signIn

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Trigger Chromium sign in of the given account.
 *
 * This also ensure that sync setup is not in progress anymore, so sync will start after
 * sync initialization has happened.
 *
 * @param activity the current activity.
 * @param accountName the full account name.
 */
public void signIn(Activity activity, String accountName) {
    final Account account = AccountManagerHelper.createAccountFromName(accountName);

    // The SigninManager handles most of the sign-in flow, and doFinishSignIn handles the
    // Chromium testshell specific details.
    SigninManager signinManager = SigninManager.get(mContext);
    signinManager.onFirstRunCheckDone();
    final boolean passive = false;
    signinManager.startSignIn(activity, account, passive, new SigninManager.Observer() {
        @Override
        public void onSigninComplete() {
            SigninManager.get(mContext).logInSignedInUser();
            mProfileSyncService.setSetupInProgress(false);
            mProfileSyncService.syncSignIn();
            start();
        }

        @Override
        public void onSigninCancelled() {
            stop();
        }
    });
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:33,代码来源:SyncController.java


示例9: shouldDisplaySyncPromo

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Determine whether the sync promo needs to be displayed.
 *
 * @return Whether sync promo should be displayed.
 */
public boolean shouldDisplaySyncPromo() {
    SigninManager signinManager = SigninManager.get(mContext);
    if (signinManager.isSigninDisabledByPolicy() || !signinManager.isSigninSupported()) {
        return false;
    }

    if (ContextUtils.getAppSharedPreferences().getBoolean(
            PREF_SIGNIN_PROMO_DECLINED, false)) {
        return false;
    }

    return !AndroidSyncSettings.isSyncEnabled(mContext) || mForeignSessions.isEmpty();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:19,代码来源:RecentTabsManager.java


示例10: SignInPromo

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
public SignInPromo(NodeParent parent, NewTabPageAdapter adapter) {
    super(parent);
    mDismissed = ChromePreferenceManager.getInstance(ContextUtils.getApplicationContext())
                         .getNewTabPageSigninPromoDismissed();

    final SigninManager signinManager = SigninManager.get(ContextUtils.getApplicationContext());
    mObserver = mDismissed ? null : new SigninObserver(signinManager, adapter);
    setVisible(signinManager.isSignInAllowed() && !signinManager.isSignedInOnNative());
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:10,代码来源:SignInPromo.java


示例11: onResume

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    // updatePreferences() must be called before setupSignInPref as updatePreferences loads
    // the SignInPreference.
    updatePreferences();

    if (SigninManager.get(getActivity()).isSigninSupported()) {
        SigninManager.get(getActivity()).addSignInStateObserver(this);
        setupSignInPref();
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:MainPreferences.java


示例12: onPause

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
@Override
public void onPause() {
    super.onPause();
    if (SigninManager.get(getActivity()).isSigninSupported()) {
        SigninManager.get(getActivity()).removeSignInStateObserver(this);
        clearSignInPref();
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:MainPreferences.java


示例13: registerForUpdates

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的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


示例14: unregisterForUpdates

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的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


示例15: updateSigninManagerFirstRunCheckDone

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Allows the user to sign-in if there are no pending FRE sign-in requests.
 * @param context A context
 */
public static void updateSigninManagerFirstRunCheckDone(Context context) {
    SigninManager manager = SigninManager.get(context);
    if (manager.isSignInAllowed()) return;
    if (!FirstRunStatus.getFirstRunFlowComplete()) return;
    if (!getFirstRunFlowSignInComplete(context)) return;
    manager.onFirstRunCheckDone();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:FirstRunSignInProcessor.java


示例16: processForcedSignIn

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Processes the fully automatic non-FRE-related forced sign-in.
 * This is used to enforce the environment for Android EDU and child accounts.
 */
private static void processForcedSignIn(final Context appContext) {
    final SigninManager signinManager = SigninManager.get(appContext);
    // By definition we have finished all the checks for first run.
    signinManager.onFirstRunCheckDone();
    if (!FeatureUtilities.canAllowSync(appContext) || !signinManager.isSignInAllowed()) {
        Log.d(TAG, "Sign in disallowed");
        return;
    }
    AccountManagerHelper.get(appContext).getGoogleAccounts(new Callback<Account[]>() {
        @Override
        public void onResult(Account[] accounts) {
            if (accounts.length != 1) {
                Log.d(TAG, "Incorrect number of accounts (%d)", accounts.length);
                return;
            }
            signinManager.signIn(accounts[0], null, new SigninManager.SignInCallback() {
                @Override
                public void onSignInComplete() {
                    // Since this is a forced signin, signout is not allowed.
                    AccountManagementFragment.setSignOutAllowedPreferenceValue(
                            appContext, false);
                }

                @Override
                public void onSignInAborted() {}
            });
        }
    });
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:34,代码来源:ForcedSigninProcessor.java


示例17: GoogleServicesManager

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的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


示例18: shouldDisplaySyncPromo

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Determine whether the sync promo needs to be displayed.
 *
 * @return Whether sync promo should be displayed.
 */
public boolean shouldDisplaySyncPromo() {
    if (SigninManager.get(mContext).isSigninDisabledByPolicy()) {
        return false;
    }

    return !AndroidSyncSettings.isSyncEnabled(mContext) || mForeignSessions.isEmpty();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:13,代码来源:RecentTabsManager.java


示例19: onResume

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    SigninManager.get(getActivity()).addSignInStateObserver(this);
    updatePreferences();

    if (mShowSearchEnginePicker) {
        mShowSearchEnginePicker = false;
        ((SearchEnginePreference) findPreference(PREF_SEARCH_ENGINE)).showDialog();
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:12,代码来源:MainPreferences.java


示例20: displayAccountPicker

import org.chromium.chrome.browser.signin.SigninManager; //导入依赖的package包/类
/**
 * Displays the account picker or the add account dialog and signs the user in.
 *
 * @return The fragment that was shown.
 */
@VisibleForTesting
public DialogFragment displayAccountPicker() {
    Context context = getActivity();
    if (context == null) return null;

    if (!SigninManager.get(context).isSignInAllowed()) {
        if (SigninManager.get(context).isSigninDisabledByPolicy()) {
            ManagedPreferencesUtils.showManagedByAdministratorToast(context);
        }
        return null;
    }

    if (AccountManagerHelper.get(context).hasGoogleAccounts()) {
        if (getFragmentManager().findFragmentByTag(ACCOUNT_PICKER_DIALOG_TAG) != null) {
            return null;
        }
        ChooseAccountFragment chooserFragment = new ChooseAccountFragment();
        chooserFragment.show(getFragmentManager(), ACCOUNT_PICKER_DIALOG_TAG);
        return chooserFragment;
    } else {
        AddGoogleAccountDialogFragment dialog = new AddGoogleAccountDialogFragment();
        dialog.setListener(new AddGoogleAccountListener() {
            @Override
            public void onAddAccountClicked() {
                AccountAdder.getInstance().addAccount(MainPreferences.this,
                        AccountAdder.ADD_ACCOUNT_RESULT);
            }
        });
        dialog.show(getFragmentManager(), null);
        return dialog;
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:38,代码来源:MainPreferences.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java UnmergedPathsException类代码示例发布时间:2022-05-22
下一篇:
Java CorsUtils类代码示例发布时间: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