org.chromium.chrome.browser.signin.SigninAccessPoint Java Examples

The following examples show how to use org.chromium.chrome.browser.signin.SigninAccessPoint. 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: RecentTabsRowAdapter.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
View getChildView(int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {
    if (convertView == null) {
        SigninAndSyncView.Listener listener = new SigninAndSyncView.Listener() {
            @Override
            public void onViewDismissed() {
                mRecentTabsManager.setSigninPromoDeclined();
                notifyDataSetChanged();
            }
        };

        convertView =
                SigninAndSyncView.create(parent, listener, SigninAccessPoint.RECENT_TABS);
    }
    if (!mRecentTabsManager.isSignedIn()) {
        RecordUserAction.record("Signin_Impression_FromRecentTabs");
    }
    return convertView;
}
 
Example #2
Source File: RecentTabsRowAdapter.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
View getChildView(int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {
    if (convertView == null) {
        SigninAndSyncView.Listener listener = new SigninAndSyncView.Listener() {
            @Override
            public void onViewDismissed() {
                mRecentTabsManager.setSigninPromoDeclined();
                notifyDataSetChanged();
            }
        };

        convertView =
                SigninAndSyncView.create(parent, listener, SigninAccessPoint.RECENT_TABS);
    }
    if (!mRecentTabsManager.isSignedIn()) {
        RecordUserAction.record("Signin_Impression_FromRecentTabs");
    }
    return convertView;
}
 
Example #3
Source File: BookmarkPromoHeader.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * @return Signin promo header {@link ViewHolder} instance that can be used with
 *         {@link RecyclerView}.
 */
ViewHolder createHolder(ViewGroup parent) {
    SigninAndSyncView.Listener listener = new SigninAndSyncView.Listener() {
        @Override
        public void onViewDismissed() {
            setSigninPromoDeclined();
            updateShouldShow(true);
        }
    };

    SigninAndSyncView view =
            SigninAndSyncView.create(parent, listener, SigninAccessPoint.BOOKMARK_MANAGER);
    // A MarginResizer is used to apply margins in regular and wide display modes. Remove the
    // view's lateral padding so that margins can be used instead.
    ApiCompatibilityUtils.setPaddingRelative(
            view, 0, view.getPaddingTop(), 0, view.getPaddingBottom());
    return new ViewHolder(view) {};
}
 
Example #4
Source File: RecentTabsRowAdapter.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
View getChildView(int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {
    if (convertView == null) {
        SigninAndSyncView.Listener listener = new SigninAndSyncView.Listener() {
            @Override
            public void onViewDismissed() {
                mRecentTabsManager.setSigninPromoDeclined();
                notifyDataSetChanged();
            }
        };

        convertView =
                SigninAndSyncView.create(parent, listener, SigninAccessPoint.RECENT_TABS);
    }
    if (!mRecentTabsManager.isSignedIn()) {
        RecordUserAction.record("Signin_Impression_FromRecentTabs");
    }
    return convertView;
}
 
Example #5
Source File: BookmarkPromoHeader.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * @return Signin promo header {@link ViewHolder} instance that can be used with
 *         {@link RecyclerView}.
 */
ViewHolder createHolder(ViewGroup parent) {
    SigninAndSyncView.Listener listener = new SigninAndSyncView.Listener() {
        @Override
        public void onViewDismissed() {
            setSigninPromoDeclined();
            updateShouldShow(true);
        }
    };

    return new ViewHolder(
            SigninAndSyncView.create(parent, listener, SigninAccessPoint.BOOKMARK_MANAGER)) {};
}
 
Example #6
Source File: BookmarkPromoHeader.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @return Signin promo header {@link ViewHolder} instance that can be used with
 *         {@link RecyclerView}.
 */
ViewHolder createHolder(ViewGroup parent) {
    SigninAndSyncView.Listener listener = new SigninAndSyncView.Listener() {
        @Override
        public void onViewDismissed() {
            setSigninPromoDeclined();
            updateShouldShow(true);
        }
    };

    return new ViewHolder(
            SigninAndSyncView.create(parent, listener, SigninAccessPoint.BOOKMARK_MANAGER)) {};
}
 
Example #7
Source File: SignInPreference.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the title, summary, and image based on the current sign-in state.
 */
private void update() {
    String accountName = ChromeSigninController.get().getSignedInAccountName();
    if (SigninManager.get(getContext()).isSigninDisabledByPolicy()) {
        setupSigninDisabled();
        mShowingPromo = false;
    } else if (accountName == null) {
        setupNotSignedIn();

        if (!mShowingPromo) {
            // This user action should be recorded when message with sign-in prompt is shown
            RecordUserAction.record("Signin_Impression_FromSettings");
        }
        mShowingPromo = true;
    } else {
        setupSignedIn(accountName);
        mShowingPromo = false;
    }

    setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            return AccountSigninActivity.startIfAllowed(
                    getContext(), SigninAccessPoint.SETTINGS);
        }
    });
}
 
Example #8
Source File: StatusListItem.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
protected void performAction(Context context) {
    AccountSigninActivity.startIfAllowed(context, SigninAccessPoint.NTP_LINK);
}
 
Example #9
Source File: SignInPreference.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * 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 {
        summary = SyncPreference.getSyncStatusSummary(getContext());
        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);
    updateSyncStatusIcon();

    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));
    }

    setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (!AccountSigninActivity.startIfAllowed(
                        getContext(), SigninAccessPoint.SETTINGS)) {
                return false;
            }

            setEnabled(false);
            return true;
        }
    });
}
 
Example #10
Source File: SignInPromo.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void performAction(Context context) {
    AccountSigninActivity.startIfAllowed(context, SigninAccessPoint.NTP_CONTENT_SUGGESTIONS);
}
 
Example #11
Source File: ChromeBlimpClientContextDelegate.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void startUserSignInFlow(Context context) {
    // TODO(xingliu): Figure out if Blimp should have its own SigninAccessPoint.
    AccountSigninActivity.startAccountSigninActivity(context, SigninAccessPoint.SETTINGS);
}
 
Example #12
Source File: SignInPreference.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * 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 {
        summary = SyncPreference.getSyncStatusSummary(getContext());
        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);
    updateSyncStatusIcon();

    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));
    }

    setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (!AccountSigninActivity.startIfAllowed(
                        getContext(), SigninAccessPoint.SETTINGS)) {
                return false;
            }

            setEnabled(false);
            return true;
        }
    });

    if (account == null && enabled) {
        RecordUserAction.record("Signin_Impression_FromSettings");
    }
}
 
Example #13
Source File: SignInPromo.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void performAction(Context context) {
    AccountSigninActivity.startIfAllowed(context, SigninAccessPoint.NTP_CONTENT_SUGGESTIONS);
}
 
Example #14
Source File: AccountFirstRunFragment.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mView.init(getPageDelegate().getProfileDataCache(),
            getProperties().getBoolean(IS_CHILD_ACCOUNT),
            getProperties().getString(FORCE_SIGNIN_ACCOUNT_TO), this,
            new AccountSigninView.Listener() {
                @Override
                public void onAccountSelectionCanceled() {
                    getPageDelegate().refuseSignIn();
                    advanceToNextPage();
                }

                @Override
                public void onNewAccount() {
                    getPageDelegate().openAccountAdder(AccountFirstRunFragment.this);
                }

                @Override
                public void onAccountSelected(
                        String accountName, boolean isDefaultAccount, boolean settingsClicked) {
                    getPageDelegate().acceptSignIn(accountName, isDefaultAccount);
                    if (settingsClicked) {
                        getPageDelegate().askToOpenSignInSettings();
                    }
                    advanceToNextPage();
                }

                @Override
                public void onFailedToSetForcedAccount(String forcedAccountName) {
                    // Somehow the forced account disappeared while we were in the FRE.
                    // The user would have to go through the FRE again.
                    getPageDelegate().abortFirstRunExperience();
                }
            });

    RecordUserAction.record("MobileFre.SignInShown");
    RecordUserAction.record("Signin_Signin_FromStartPage");
    SigninManager.logSigninStartAccessPoint(SigninAccessPoint.START_PAGE);
}