Skip to content

Commit

Permalink
Chromium: Make password saving option independent from autofill optio…
Browse files Browse the repository at this point in the history
…n in Privacy settings

    Currently in Privacy settings in Chromium backend, the password saving option depends on the autofill option. If autofill is disabled, password saving doesn't work whether enabled or not. This is because Chromium doesn't provide an autofill option but provides a login selection prompt that asks users whether to autofill the saved password or not. This commit makes password saving option independent from autofill option. The autofill option now only affects whether to show login selection prompt.

    Fixes #1707
  • Loading branch information
haanhvu committed Feb 3, 2025
1 parent 1e871dd commit c3ac890
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,8 @@ public class AutocompleteBridge implements PasswordManager.Bridge, AutofillManag
private LoginSavePrompt mLoginSavePrompt;
private LoginSelectPrompt mLoginSelectPrompt;

private boolean showLoginSelectPrompt;

public void setListener(PasswordManager.Listener listener) {
mPasswordManagerListener = listener;
}
Expand All @@ -973,7 +975,11 @@ public boolean isAutocompleteEnabled(Context context) {

@Override
public boolean isAutoFillEnabled(Context context) {
return SettingsStore.getInstance(context).isAutoFillEnabled();
// Chromium doesn't provide an autofill option.
// Instead, it provides a login selection prompt that let users decide whether to autofill the saved password or not.
// We'll only show this prompt if users enable autofill.
showLoginSelectPrompt = SettingsStore.getInstance(context).isAutoFillEnabled();
return true;
}

@Override
Expand Down Expand Up @@ -1011,6 +1017,10 @@ public boolean saveOrUpdatePassword(PasswordForm form) {

@Override
public boolean onLoginSelect(PasswordForm[] forms) {
if (!showLoginSelectPrompt) {
return false;
}

dismiss();
assert mPasswordManagerListener != null;

Expand Down Expand Up @@ -1038,6 +1048,10 @@ public boolean onLoginSelect(PasswordForm[] forms) {

@Override
public boolean onLoginSelect(String[] username) {
if (!showLoginSelectPrompt) {
return false;
}

dismiss();
assert mAutofillManagerListener != null;

Expand Down

0 comments on commit c3ac890

Please sign in to comment.