Java Code Examples for org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils#saveFrePromoOptOut()

The following examples show how to use org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils#saveFrePromoOptOut() . 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: FirstRunActivity.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void completeFirstRunExperience() {
    if (!TextUtils.isEmpty(mResultSignInAccountName)) {
        boolean defaultAccountName =
                sGlue.isDefaultAccountName(getApplicationContext(), mResultSignInAccountName);
        int choice;
        if (mResultShowSignInSettings) {
            if (defaultAccountName) {
                choice = SIGNIN_SETTINGS_DEFAULT_ACCOUNT;
            } else {
                choice = SIGNIN_SETTINGS_ANOTHER_ACCOUNT;
            }
        } else {
            if (defaultAccountName) {
                choice = SIGNIN_ACCEPT_DEFAULT_ACCOUNT;
            } else {
                choice = SIGNIN_ACCEPT_ANOTHER_ACCOUNT;
            }
        }
        RecordHistogram.recordEnumeratedHistogram(
                UMA_SIGNIN_CHOICE, choice, SIGNIN_OPTION_COUNT);

        String entryType = mFreProperties.getBoolean(FirstRunActivity.COMING_FROM_CHROME_ICON)
                ? UMA_SIGNIN_CHOICE_ENTRY_MAIN_INTENT : UMA_SIGNIN_CHOICE_ENTRY_VIEW_INTENT;
        int numAccounts = sGlue.numberOfAccounts(getApplicationContext());
        String numAccountsString;
        if (numAccounts == 0) {
            numAccountsString = UMA_SIGNIN_CHOICE_ZERO_ACCOUNTS;
        } else if (numAccounts == 1) {
            numAccountsString = UMA_SIGNIN_CHOICE_ONE_ACCOUNT;
        } else {
            numAccountsString = UMA_SIGNIN_CHOICE_MANY_ACCOUNTS;
        }
        RecordHistogram.recordEnumeratedHistogram(
                UMA_SIGNIN_CHOICE + entryType + numAccountsString, choice, SIGNIN_OPTION_COUNT);
    }

    mFreProperties.putString(RESULT_SIGNIN_ACCOUNT_NAME, mResultSignInAccountName);
    mFreProperties.putBoolean(RESULT_SHOW_SIGNIN_SETTINGS, mResultShowSignInSettings);
    FirstRunFlowSequencer.markFlowAsCompleted(this, mFreProperties);

    if (DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()) {
        if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
            DataReductionProxyUma
                    .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_FRE_ENABLED);
            DataReductionPromoUtils.saveFrePromoOptOut(false);
        } else {
            DataReductionProxyUma
                    .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_FRE_DISABLED);
            DataReductionPromoUtils.saveFrePromoOptOut(true);
        }
    }

    Intent resultData = new Intent();
    resultData.putExtras(mFreProperties);
    finishAllFREActivities(Activity.RESULT_OK, resultData);
}
 
Example 2
Source File: FirstRunActivity.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void completeFirstRunExperience() {
    if (!TextUtils.isEmpty(mResultSignInAccountName)) {
        boolean defaultAccountName =
                sGlue.isDefaultAccountName(getApplicationContext(), mResultSignInAccountName);
        int choice;
        if (mResultShowSignInSettings) {
            if (defaultAccountName) {
                choice = SIGNIN_SETTINGS_DEFAULT_ACCOUNT;
            } else {
                choice = SIGNIN_SETTINGS_ANOTHER_ACCOUNT;
            }
        } else {
            if (defaultAccountName) {
                choice = SIGNIN_ACCEPT_DEFAULT_ACCOUNT;
            } else {
                choice = SIGNIN_ACCEPT_ANOTHER_ACCOUNT;
            }
        }
        sSigninChoiceHistogram.record(choice);
        recordFreProgressHistogram(FRE_PROGRESS_COMPLETED_SIGNED_IN);
    } else {
        recordFreProgressHistogram(FRE_PROGRESS_COMPLETED_NOT_SIGNED_IN);
    }

    mFreProperties.putString(RESULT_SIGNIN_ACCOUNT_NAME, mResultSignInAccountName);
    mFreProperties.putBoolean(RESULT_SHOW_SIGNIN_SETTINGS, mResultShowSignInSettings);
    FirstRunFlowSequencer.markFlowAsCompleted(this, mFreProperties);

    if (DataReductionPromoUtils.getDisplayedFreOrSecondRunPromo()) {
        if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
            DataReductionProxyUma
                    .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_FRE_ENABLED);
            DataReductionPromoUtils.saveFrePromoOptOut(false);
        } else {
            DataReductionProxyUma
                    .dataReductionProxyUIAction(DataReductionProxyUma.ACTION_FRE_DISABLED);
            DataReductionPromoUtils.saveFrePromoOptOut(true);
        }
    }

    Intent resultData = new Intent();
    resultData.putExtras(mFreProperties);
    finishAllTheActivities(getLocalClassName(), Activity.RESULT_OK, resultData);

    sendPendingIntentIfNecessary(true);
}