org.chromium.chrome.browser.profiles.ProfileAccountManagementMetrics Java Examples

The following examples show how to use org.chromium.chrome.browser.profiles.ProfileAccountManagementMetrics. 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: AccountManagementFragment.java    From delion with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #2
Source File: AccountManagementFragment.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onSignOutClicked() {
    // In case the user reached this fragment without being signed in, we guard the sign out so
    // we do not hit a native crash.
    if (!ChromeSigninController.get(getActivity()).isSignedIn()) return;

    final Activity activity = getActivity();
    final DialogFragment clearDataProgressDialog = new ClearDataProgressDialog();
    SigninManager.get(activity).signOut(null, new SigninManager.WipeDataHooks() {
        @Override
        public void preWipeData() {
            clearDataProgressDialog.show(
                    activity.getFragmentManager(), CLEAR_DATA_PROGRESS_DIALOG_TAG);
        }
        @Override
        public void postWipeData() {
            if (clearDataProgressDialog.isAdded()) {
                clearDataProgressDialog.dismissAllowingStateLoss();
            }
        }
    });
    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT,
            mGaiaServiceType);
}
 
Example #3
Source File: AccountManagementFragment.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onSignOutClicked() {
    // In case the user reached this fragment without being signed in, we guard the sign out so
    // we do not hit a native crash.
    if (!ChromeSigninController.get().isSignedIn()) return;

    final Activity activity = getActivity();
    final DialogFragment clearDataProgressDialog = new ClearDataProgressDialog();
    SigninManager.get(activity).signOut(null, new SigninManager.WipeDataHooks() {
        @Override
        public void preWipeData() {
            clearDataProgressDialog.show(
                    activity.getFragmentManager(), CLEAR_DATA_PROGRESS_DIALOG_TAG);
        }
        @Override
        public void postWipeData() {
            if (clearDataProgressDialog.isAdded()) {
                clearDataProgressDialog.dismissAllowingStateLoss();
            }
        }
    });
    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT,
            mGaiaServiceType);
}
 
Example #4
Source File: AccountManagementFragment.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #5
Source File: AccountManagementFragment.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #6
Source File: AccountManagementFragment.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void onSignOutClicked() {
    // In case the user reached this fragment without being signed in, we guard the sign out so
    // we do not hit a native crash.
    if (!ChromeSigninController.get(getActivity()).isSignedIn()) return;

    final Activity activity = getActivity();
    final DialogFragment clearDataProgressDialog = new ClearDataProgressDialog();
    SigninManager.get(activity).signOut(null, new SigninManager.WipeDataHooks() {
        @Override
        public void preWipeData() {
            clearDataProgressDialog.show(
                    activity.getFragmentManager(), CLEAR_DATA_PROGRESS_DIALOG_TAG);
        }
        @Override
        public void postWipeData() {
            if (clearDataProgressDialog.isAdded()) {
                clearDataProgressDialog.dismissAllowingStateLoss();
            }
        }
    });
    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT,
            mGaiaServiceType);
}
 
Example #7
Source File: SignOutDialogFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.SIGNOUT_CANCEL, mGaiaServiceType);

    SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
    targetFragment.onSignOutDialogDismissed(mSignOutClicked);
}
 
Example #8
Source File: AccountManagementScreenHelper.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Opens the Android account manager for adding or creating a Google account.
 */
private static void openAndroidAccountCreationScreen() {
    logEvent(ProfileAccountManagementMetrics.DIRECT_ADD_ACCOUNT, GAIA_SERVICE_TYPE_SIGNUP);

    Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    createAccountIntent.putExtra(
            EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
    createAccountIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
            | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    ContextUtils.getApplicationContext().startActivity(createAccountIntent);
}
 
Example #9
Source File: AccountManagementFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onSignOutDialogDismissed(boolean signOutClicked) {
    if (!signOutClicked) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_CANCEL,
                mGaiaServiceType);
    }
}
 
Example #10
Source File: SignOutDialogFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.SIGNOUT_CANCEL, mGaiaServiceType);

    SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
    targetFragment.onSignOutDialogDismissed(mSignOutClicked);
}
 
Example #11
Source File: SignOutDialogFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT, mGaiaServiceType);

        mSignOutClicked = true;
        SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
        targetFragment.onSignOutClicked();
    }
}
 
Example #12
Source File: AccountManagementScreenHelper.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Opens the Android account manager for adding or creating a Google account.
 * @param applicationContext
 */
private static void openAndroidAccountCreationScreen(
        Context applicationContext) {
    logEvent(ProfileAccountManagementMetrics.DIRECT_ADD_ACCOUNT, GAIA_SERVICE_TYPE_SIGNUP);

    Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    createAccountIntent.putExtra(
            EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
    createAccountIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
            | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    applicationContext.startActivity(createAccountIntent);
}
 
Example #13
Source File: AccountManagementFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onSignOutDialogDismissed(boolean signOutClicked) {
    if (!signOutClicked) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_CANCEL,
                mGaiaServiceType);
    }
}
 
Example #14
Source File: SignOutDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    AccountManagementScreenHelper.logEvent(
            ProfileAccountManagementMetrics.SIGNOUT_CANCEL, mGaiaServiceType);

    SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
    targetFragment.onSignOutDialogDismissed(mSignOutClicked);
}
 
Example #15
Source File: SignOutDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT, mGaiaServiceType);

        mSignOutClicked = true;
        SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
        targetFragment.onSignOutClicked();
    }
}
 
Example #16
Source File: AccountManagementScreenHelper.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Opens the Android account manager for adding or creating a Google account.
 * @param applicationContext
 */
private static void openAndroidAccountCreationScreen(
        Context applicationContext) {
    logEvent(ProfileAccountManagementMetrics.DIRECT_ADD_ACCOUNT, GAIA_SERVICE_TYPE_SIGNUP);

    Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    createAccountIntent.putExtra(
            EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
    createAccountIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
            | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    applicationContext.startActivity(createAccountIntent);
}
 
Example #17
Source File: AccountManagementFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onSignOutDialogDismissed(boolean signOutClicked) {
    if (!signOutClicked) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_CANCEL,
                mGaiaServiceType);
    }
}
 
Example #18
Source File: SignOutDialogFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == AlertDialog.BUTTON_POSITIVE) {
        AccountManagementScreenHelper.logEvent(
                ProfileAccountManagementMetrics.SIGNOUT_SIGNOUT, mGaiaServiceType);

        mSignOutClicked = true;
        SignOutDialogListener targetFragment = (SignOutDialogListener) getTargetFragment();
        targetFragment.onSignOutClicked();
    }
}
 
Example #19
Source File: AccountManagementFragment.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void configureSignOutSwitch() {
    boolean isChildAccount = ChildAccountService.isChildAccount();

    Preference signOutSwitch = findPreference(PREF_SIGN_OUT);
    if (isChildAccount) {
        getPreferenceScreen().removePreference(signOutSwitch);
    } else {
        signOutSwitch.setEnabled(getSignOutAllowedPreferenceValue(getActivity()));
        signOutSwitch.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                if (!isVisible() || !isResumed()) return false;

                if (ChromeSigninController.get(getActivity()).isSignedIn()
                        && getSignOutAllowedPreferenceValue(getActivity())) {
                    AccountManagementScreenHelper.logEvent(
                            ProfileAccountManagementMetrics.TOGGLE_SIGNOUT,
                            mGaiaServiceType);

                    String managementDomain =
                            SigninManager.get(getActivity()).getManagementDomain();
                    if (managementDomain != null) {
                        // Show the 'You are signing out of a managed account' dialog.
                        ConfirmManagedSyncDataDialog.showSignOutFromManagedAccountDialog(
                                AccountManagementFragment.this, getFragmentManager(),
                                getResources(), managementDomain);
                    } else {
                        // Show the 'You are signing out' dialog.
                        SignOutDialogFragment signOutFragment = new SignOutDialogFragment();
                        Bundle args = new Bundle();
                        args.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
                        signOutFragment.setArguments(args);

                        signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
                        signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
                    }

                    return true;
                }

                return false;
            }

        });
    }
}
 
Example #20
Source File: AccountManagementFragment.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void configureSignOutSwitch() {
    Preference signOutSwitch = findPreference(PREF_SIGN_OUT);
    if (mProfile.isChild()) {
        getPreferenceScreen().removePreference(signOutSwitch);
    } else {
        signOutSwitch.setEnabled(getSignOutAllowedPreferenceValue());
        signOutSwitch.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                if (!isVisible() || !isResumed()) return false;

                if (mSignedInAccountName != null && getSignOutAllowedPreferenceValue()) {
                    AccountManagementScreenHelper.logEvent(
                            ProfileAccountManagementMetrics.TOGGLE_SIGNOUT,
                            mGaiaServiceType);

                    String managementDomain =
                            SigninManager.get(getActivity()).getManagementDomain();
                    if (managementDomain != null) {
                        // Show the 'You are signing out of a managed account' dialog.
                        ConfirmManagedSyncDataDialog.showSignOutFromManagedAccountDialog(
                                AccountManagementFragment.this, getFragmentManager(),
                                getResources(), managementDomain);
                    } else {
                        // Show the 'You are signing out' dialog.
                        SignOutDialogFragment signOutFragment = new SignOutDialogFragment();
                        Bundle args = new Bundle();
                        args.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
                        signOutFragment.setArguments(args);

                        signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
                        signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
                    }

                    return true;
                }

                return false;
            }
        });
    }
}
 
Example #21
Source File: AccountManagementFragment.java    From delion with Apache License 2.0 4 votes vote down vote up
private void configureSignOutSwitch() {
    boolean isChildAccount = ChildAccountService.isChildAccount();

    Preference signOutSwitch = findPreference(PREF_SIGN_OUT);
    if (isChildAccount) {
        getPreferenceScreen().removePreference(signOutSwitch);
    } else {
        signOutSwitch.setEnabled(getSignOutAllowedPreferenceValue(getActivity()));
        signOutSwitch.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                if (!isVisible() || !isResumed()) return false;

                if (ChromeSigninController.get(getActivity()).isSignedIn()
                        && getSignOutAllowedPreferenceValue(getActivity())) {
                    AccountManagementScreenHelper.logEvent(
                            ProfileAccountManagementMetrics.TOGGLE_SIGNOUT,
                            mGaiaServiceType);

                    String managementDomain =
                            SigninManager.get(getActivity()).getManagementDomain();
                    if (managementDomain != null) {
                        // Show the 'You are signing out of a managed account' dialog.
                        ConfirmManagedSyncDataDialog.showSignOutFromManagedAccountDialog(
                                AccountManagementFragment.this, getFragmentManager(),
                                getResources(), managementDomain);
                    } else {
                        // Show the 'You are signing out' dialog.
                        SignOutDialogFragment signOutFragment = new SignOutDialogFragment();
                        Bundle args = new Bundle();
                        args.putInt(SHOW_GAIA_SERVICE_TYPE_EXTRA, mGaiaServiceType);
                        signOutFragment.setArguments(args);

                        signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
                        signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
                    }

                    return true;
                }

                return false;
            }

        });
    }
}