org.chromium.chrome.browser.signin.SigninManager.SignInCallback Java Examples

The following examples show how to use org.chromium.chrome.browser.signin.SigninManager.SignInCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SigninHelper.java    From delion with Apache License 2.0 6 votes vote down vote up
private void performResignin(String newName) {
    // This is the correct account now.
    final Account account = AccountManagerHelper.createAccountFromName(newName);

    mSigninManager.signIn(account, null, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            if (mProfileSyncService != null) {
                mProfileSyncService.setSetupInProgress(false);
            }
            validateAccountSettings(true);
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example #2
Source File: AccountSigninActivity.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onAccountSelected(final String accountName, final boolean settingsClicked) {
    final Context context = this;
    SigninManager.get(this).signIn(accountName, this, new SignInCallback(){

        @Override
        public void onSignInComplete() {
            if (settingsClicked) {
                Intent intent = PreferencesLauncher.createIntentForSettingsPage(
                        context, AccountManagementFragment.class.getName());
                startActivity(intent);
            }

            finish();
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example #3
Source File: SigninHelper.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void performResignin(String newName) {
    // This is the correct account now.
    final Account account = AccountManagerHelper.createAccountFromName(newName);

    mSigninManager.signIn(account, null, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            if (mProfileSyncService != null) {
                mProfileSyncService.setSetupInProgress(false);
            }
            validateAccountSettings(true);
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example #4
Source File: AccountSigninActivity.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onAccountSelected(final String accountName, final boolean settingsClicked) {
    final Context context = this;
    SigninManager.get(this).signIn(accountName, this, new SignInCallback(){

        @Override
        public void onSignInComplete() {
            if (settingsClicked) {
                Intent intent = PreferencesLauncher.createIntentForSettingsPage(
                        context, AccountManagementFragment.class.getName());
                startActivity(intent);
            }

            finish();
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example #5
Source File: SigninHelper.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void performResignin(String newName) {
    // This is the correct account now.
    final Account account = AccountManagerHelper.createAccountFromName(newName);

    mSigninManager.signIn(account, null, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            if (mProfileSyncService != null) {
                mProfileSyncService.setSetupInProgress(false);
            }
            validateAccountSettings(true);
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example #6
Source File: AccountSigninActivity.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onAccountSelected(
        final String accountName, boolean isDefaultAccount, final boolean settingsClicked) {
    final Context context = this;
    SigninManager.get(this).signIn(accountName, this, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            if (settingsClicked) {
                Intent intent = PreferencesLauncher.createIntentForSettingsPage(
                        context, AccountManagementFragment.class.getName());
                startActivity(intent);
            }

            finish();
        }

        @Override
        public void onSignInAborted() {}
    });
}
 
Example #7
Source File: FirstRunSignInProcessor.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Initiates the automatic sign-in process in background.
 *
 * @param activity The context for the FRE parameters processor.
 */
public static void start(final Activity activity) {
    SigninManager signinManager = SigninManager.get(activity.getApplicationContext());
    signinManager.onFirstRunCheckDone();

    boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete(activity);
    // We skip signin and the FRE only if
    // - FRE is disabled, or
    // - FRE hasn't been completed, but the user has already seen the ToS in the Setup Wizard.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
            || (!firstRunFlowComplete && ToSAckedReceiver.checkAnyUserHasSeenToS(activity))) {
        return;
    }

    // Skip sign in if Chrome is neither started via Chrome icon nor GSA (Google Search App).
    if (!TextUtils.equals(activity.getIntent().getAction(), Intent.ACTION_MAIN)
            && IntentHandler.determineExternalIntentSource(
                       activity.getPackageName(), activity.getIntent())
                    != ExternalAppId.GSA) {
        return;
    }

    // Otherwise, force trigger the FRE.
    if (!firstRunFlowComplete) {
        requestToFireIntentAndFinish(activity);
        return;
    }

    // We are only processing signin from the FRE.
    if (getFirstRunFlowSignInComplete(activity)) {
        return;
    }
    final String accountName = getFirstRunFlowSignInAccountName(activity);
    if (!FeatureUtilities.canAllowSync(activity) || !signinManager.isSignInAllowed()
            || TextUtils.isEmpty(accountName)) {
        setFirstRunFlowSignInComplete(activity, true);
        return;
    }

    final boolean setUp = getFirstRunFlowSignInSetup(activity);
    signinManager.signIn(accountName, activity, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            // Show sync settings if user pressed the "Settings" button.
            if (setUp) {
                openSignInSettings(activity);
            }
            setFirstRunFlowSignInComplete(activity, true);
        }

        @Override
        public void onSignInAborted() {
            // Set FRE as complete even if signin fails because the user has already seen and
            // accepted the terms of service.
            setFirstRunFlowSignInComplete(activity, true);
        }
    });
}
 
Example #8
Source File: FirstRunSignInProcessor.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Initiates the automatic sign-in process in background.
 *
 * @param activity The context for the FRE parameters processor.
 */
public static void start(final Activity activity) {
    SigninManager signinManager = SigninManager.get(activity.getApplicationContext());
    signinManager.onFirstRunCheckDone();

    boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete();
    // We skip signin and the FRE if
    // - FRE is disabled, or
    // - FRE hasn't been completed, but the user has already seen the ToS in the Setup Wizard.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
            || ApiCompatibilityUtils.isDemoUser(activity)
            || (!firstRunFlowComplete && ToSAckedReceiver.checkAnyUserHasSeenToS(activity))) {
        return;
    }

    // Force trigger the FRE if the Lightweight FRE is disabled or Chrome is started via Chrome
    // icon or via intent from GSA. Otherwise, skip signin.
    if (!firstRunFlowComplete) {
        if (!CommandLine.getInstance().hasSwitch(
                    ChromeSwitches.ENABLE_LIGHTWEIGHT_FIRST_RUN_EXPERIENCE)
                || TextUtils.equals(activity.getIntent().getAction(), Intent.ACTION_MAIN)
                || IntentHandler.determineExternalIntentSource(
                           activity.getPackageName(), activity.getIntent())
                        == ExternalAppId.GSA) {
            requestToFireIntentAndFinish(activity);
        }
        return;
    }

    // We are only processing signin from the FRE.
    if (getFirstRunFlowSignInComplete(activity)) {
        return;
    }
    final String accountName = getFirstRunFlowSignInAccountName(activity);
    if (!FeatureUtilities.canAllowSync(activity) || !signinManager.isSignInAllowed()
            || TextUtils.isEmpty(accountName)) {
        setFirstRunFlowSignInComplete(activity, true);
        return;
    }

    final boolean setUp = getFirstRunFlowSignInSetup(activity);
    signinManager.signIn(accountName, activity, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            // Show sync settings if user pressed the "Settings" button.
            if (setUp) {
                openSignInSettings(activity);
            }
            setFirstRunFlowSignInComplete(activity, true);
        }

        @Override
        public void onSignInAborted() {
            // Set FRE as complete even if signin fails because the user has already seen and
            // accepted the terms of service.
            setFirstRunFlowSignInComplete(activity, true);
        }
    });
}
 
Example #9
Source File: FirstRunSignInProcessor.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Initiates the automatic sign-in process in background.
 *
 * @param activity The context for the FRE parameters processor.
 */
public static void start(final Activity activity) {
    SigninManager signinManager = SigninManager.get(activity.getApplicationContext());
    signinManager.onFirstRunCheckDone();

    boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete();
    // We skip signin and the FRE if
    // - FRE is disabled, or
    // - FRE hasn't been completed, but the user has already seen the ToS in the Setup Wizard.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
            || ApiCompatibilityUtils.isDemoUser(activity)
            || (!firstRunFlowComplete && ToSAckedReceiver.checkAnyUserHasSeenToS(activity))) {
        return;
    }

    // Force trigger the FRE if the Lightweight FRE is disabled or Chrome is started via Chrome
    // icon or via intent from GSA. Otherwise, skip signin.
    if (!firstRunFlowComplete) {
        if (!CommandLine.getInstance().hasSwitch(
                    ChromeSwitches.ENABLE_LIGHTWEIGHT_FIRST_RUN_EXPERIENCE)
                || TextUtils.equals(activity.getIntent().getAction(), Intent.ACTION_MAIN)
                || IntentHandler.determineExternalIntentSource(
                           activity.getPackageName(), activity.getIntent())
                        == ExternalAppId.GSA) {
            requestToFireIntentAndFinish(activity);
        }
        return;
    }

    // We are only processing signin from the FRE.
    if (getFirstRunFlowSignInComplete(activity)) {
        return;
    }
    final String accountName = getFirstRunFlowSignInAccountName(activity);
    if (!FeatureUtilities.canAllowSync(activity) || !signinManager.isSignInAllowed()
            || TextUtils.isEmpty(accountName)) {
        setFirstRunFlowSignInComplete(activity, true);
        return;
    }

    final boolean setUp = getFirstRunFlowSignInSetup(activity);
    signinManager.signIn(accountName, activity, new SignInCallback() {
        @Override
        public void onSignInComplete() {
            // Show sync settings if user pressed the "Settings" button.
            if (setUp) {
                openSignInSettings(activity);
            }
            setFirstRunFlowSignInComplete(activity, true);
        }

        @Override
        public void onSignInAborted() {
            // Set FRE as complete even if signin fails because the user has already seen and
            // accepted the terms of service.
            setFirstRunFlowSignInComplete(activity, true);
        }
    });
}