Skip to content

Commit

Permalink
[APC] Remove mobile settings entry point.
Browse files Browse the repository at this point in the history
NOTE: I will remove the script fetcher and its methods usages in a follow up CL.

Bug: 1386065
Change-Id: Ifd983a20ddd9ee59a33d79406dff0ed5369aedbf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4041263
Reviewed-by: Jan Keitel <jkeitel@google.com>
Reviewed-by: Friedrich Horschig <fhorschig@chromium.org>
Commit-Queue: Bruno Braga <brunobraga@google.com>
Reviewed-by: Norge Vizcay <vizcay@google.com>
Cr-Commit-Position: refs/heads/main@{#1075271}
  • Loading branch information
Bruno Braga authored and Chromium LUCI CQ committed Nov 23, 2022
1 parent 5a5d5f6 commit 5ce36c0
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 827 deletions.
1 change: 0 additions & 1 deletion chrome/browser/password_check/android/internal/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ android_resources("java_resources") {
"java/res/drawable-night/password_check_positive.xml",
"java/res/drawable/password_check_positive.xml",
"java/res/layout/password_check_compromised_credential_item.xml",
"java/res/layout/password_check_compromised_credential_with_script_item.xml",
"java/res/layout/password_check_header_item.xml",
"java/res/layout/password_check_view_credential_dialog.xml",
"java/res/values/dimens.xml",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ found in the LICENSE file.
<dimen name="check_status_message_running_margin_vertical">36dp</dimen>

<dimen name="compromised_credential_row_button_icon_padding">8dp</dimen>
<dimen name="compromised_credential_row_button_text_margin_top">8dp</dimen>
<dimen name="compromised_credential_row_button_icon_start_padding">12dp</dimen>
<dimen name="compromised_credential_row_button_icon_end_padding">16dp</dimen>
<dimen name="compromised_credential_row_button_margin_top">16dp</dimen>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,10 @@ void onPasswordCheckProgressChanged(int alreadyProcessed, int remainingInQueue)
private static void insertCredential(CompromisedCredential[] credentials, int index,
String signonRealm, GURL associatedUrl, String username, String displayOrigin,
String displayUsername, String password, String passwordChangeUrl, String associatedApp,
long creationTime, long lastUsedTime, boolean leaked, boolean phished,
boolean hasStartableScript, boolean hasAutoChangeButton) {
credentials[index] =
new CompromisedCredential(signonRealm, associatedUrl, username, displayOrigin,
displayUsername, password, passwordChangeUrl, associatedApp, creationTime,
lastUsedTime, leaked, phished, hasStartableScript, hasAutoChangeButton);
long creationTime, long lastUsedTime, boolean leaked, boolean phished) {
credentials[index] = new CompromisedCredential(signonRealm, associatedUrl, username,
displayOrigin, displayUsername, password, passwordChangeUrl, associatedApp,
creationTime, lastUsedTime, leaked, phished);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ interface CredentialEventHandler {
* @param credential A {@link CompromisedCredential} to be changed.
*/
void onChangePasswordButtonClick(CompromisedCredential credential);

/**
* Starts a script to change a {@link CompromisedCredential}. Can be called only if {@link
* CompromisedCredential#hasScript()}.
* @param credential A {@link CompromisedCredential} to be change with a script.
*/
void onChangePasswordWithScriptButtonClick(CompromisedCredential credential);
}

PasswordCheckCoordinator(PasswordCheckFragmentView fragmentView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import org.chromium.base.task.PostTask;
import org.chromium.chrome.browser.device_reauth.ReauthenticatorBridge;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.password_check.helper.PasswordCheckChangePasswordHelper;
import org.chromium.chrome.browser.password_check.helper.PasswordCheckIconHelper;
import org.chromium.chrome.browser.password_manager.PasswordCheckReferrer;
Expand Down Expand Up @@ -205,7 +204,8 @@ private void changePasswordCheckStatus(@PasswordCheckUIStatus int status) {

// If a check was just completed, record some metrics.
if (oldStatus == PasswordCheckUIStatus.RUNNING) {
recordMetricsOnCheckCompletion();
PasswordCheckMetricsRecorder.recordCompromisedCredentialsCountAfterCheck(
compromisedCredentialCount);
}
}
header.set(CHECK_TIMESTAMP, checkTimestamp);
Expand All @@ -216,22 +216,6 @@ private void changePasswordCheckStatus(@PasswordCheckUIStatus int status) {
}
}

private void recordMetricsOnCheckCompletion() {
int countTotal = 0;
int countWithAutoChange = 0;
// Note: items[0] is the header, so skip that one.
ListModel<ListItem> items = mModel.get(ITEMS);
for (int i = 1; i < items.size(); i++) {
countTotal++;
CompromisedCredential credential = items.get(i).model.get(COMPROMISED_CREDENTIAL);
if (credential.hasAutoChangeButton()) {
countWithAutoChange++;
}
}
PasswordCheckMetricsRecorder.recordCompromisedCredentialsCountAfterCheck(
countTotal, countWithAutoChange);
}

@Override
public void onPasswordCheckProgressChanged(int alreadyProcessed, int remainingInQueue) {
ListModel<ListItem> items = mModel.get(ITEMS);
Expand Down Expand Up @@ -315,42 +299,14 @@ public void onDismiss() {

@Override
public void onChangePasswordButtonClick(CompromisedCredential credential) {
PasswordCheckMetricsRecorder.recordUiUserAction(credential.hasAutoChangeButton()
? PasswordCheckUserAction.CHANGE_PASSWORD_MANUALLY
: PasswordCheckUserAction.CHANGE_PASSWORD);
PasswordCheckMetricsRecorder.recordUiUserAction(PasswordCheckUserAction.CHANGE_PASSWORD);
PasswordCheckMetricsRecorder.recordCheckResolutionAction(
PasswordCheckResolutionAction.OPENED_SITE, credential);
mCctIsOpened = true;
mDelegate.onManualPasswordChangeStarted(credential);
mChangePasswordDelegate.launchAppOrCctWithChangePasswordUrl(credential);
}

@Override
public void onChangePasswordWithScriptButtonClick(CompromisedCredential credential) {
if (!mReauthenticatorBridge.canUseAuthentication()
|| !ChromeFeatureList.isEnabled(ChromeFeatureList.BIOMETRIC_TOUCH_TO_FILL)) {
startAutomatedPasswordChange(credential);
return;
}

mReauthenticatorBridge.reauthenticate(reauthSucceeded -> {
if (reauthSucceeded) {
startAutomatedPasswordChange(credential);
}
}, true);
}

private void startAutomatedPasswordChange(CompromisedCredential credential) {
assert credential.hasAutoChangeButton();
PasswordCheckMetricsRecorder.recordUiUserAction(
PasswordCheckUserAction.CHANGE_PASSWORD_AUTOMATICALLY);
PasswordCheckMetricsRecorder.recordCheckResolutionAction(
PasswordCheckResolutionAction.STARTED_SCRIPT, credential);
mCctIsOpened = true;
mDelegate.onAutomatedPasswordChangeStarted(credential);
mChangePasswordDelegate.launchCctWithScript(credential);
}

private void updateStatusHeaderWhenCredentialsChange() {
ListModel<ListItem> items = mModel.get(ITEMS);
assert items.size() >= 1;
Expand Down Expand Up @@ -413,10 +369,8 @@ private ListItem createEntryForCredential(CompromisedCredential credential) {
mIconHelper.getLargeIcon(credential, (faviconOrFallback) -> {
credentialModel.set(FAVICON_OR_FALLBACK, faviconOrFallback);
});
return new ListItem(credential.hasAutoChangeButton()
? PasswordCheckProperties.ItemType.COMPROMISED_CREDENTIAL_WITH_SCRIPT
: PasswordCheckProperties.ItemType.COMPROMISED_CREDENTIAL,
credentialModel);
return new ListItem(
PasswordCheckProperties.ItemType.COMPROMISED_CREDENTIAL, credentialModel);
}

private void sortCredentials(List<CompromisedCredential> credentials) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ static class HeaderProperties {
private HeaderProperties() {}
}

@IntDef({ItemType.HEADER, ItemType.COMPROMISED_CREDENTIAL,
ItemType.COMPROMISED_CREDENTIAL_WITH_SCRIPT})
@IntDef({ItemType.HEADER, ItemType.COMPROMISED_CREDENTIAL})
@Retention(RetentionPolicy.SOURCE)
@interface ItemType {
/**
Expand All @@ -107,12 +106,6 @@ private HeaderProperties() {}
* A section containing a user's name and password.
*/
int COMPROMISED_CREDENTIAL = 2;

/**
* A section containing a user's name and password for a domain where a password change
* script is available.
*/
int COMPROMISED_CREDENTIAL_WITH_SCRIPT = 3;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ private static PasswordCheckViewHolder createViewHolder(
return new PasswordCheckViewHolder(parent,
R.layout.password_check_compromised_credential_item,
PasswordCheckViewBinder::bindCredentialView);
case ItemType.COMPROMISED_CREDENTIAL_WITH_SCRIPT:
return new PasswordCheckViewHolder(parent,
R.layout.password_check_compromised_credential_with_script_item,
PasswordCheckViewBinder::bindCredentialView);
}
assert false : "Cannot create view for ItemType: " + itemType;
return null;
Expand Down Expand Up @@ -165,13 +161,6 @@ private static void bindCredentialView(
});
setTintListForCompoundDrawables(button.getCompoundDrawablesRelative(),
view.getContext(), R.color.default_text_color_on_accent1_list);
if (credential.hasAutoChangeButton()) {
ButtonCompat button_with_script =
view.findViewById(R.id.credential_change_button_with_script);
button_with_script.setOnClickListener(unusedView -> {
model.get(CREDENTIAL_HANDLER).onChangePasswordWithScriptButtonClick(credential);
});
}
} else if (propertyKey == CREDENTIAL_HANDLER) {
assert model.get(CREDENTIAL_HANDLER) != null;
// Is read-only and must therefore be bound initially, so no action required.
Expand All @@ -180,9 +169,7 @@ private static void bindCredentialView(
button.setVisibility(model.get(HAS_MANUAL_CHANGE_BUTTON) ? View.VISIBLE : View.GONE);
TextView changeHint = view.findViewById(R.id.credential_change_hint);
changeHint.setVisibility(
model.get(HAS_MANUAL_CHANGE_BUTTON) || credential.hasAutoChangeButton()
? View.GONE
: View.VISIBLE);
model.get(HAS_MANUAL_CHANGE_BUTTON) ? View.GONE : View.VISIBLE);
} else if (propertyKey == FAVICON_OR_FALLBACK) {
ImageView imageView = view.findViewById(R.id.credential_favicon);
PasswordCheckIconHelper.FaviconOrFallback data = model.get(FAVICON_OR_FALLBACK);
Expand Down
Loading

0 comments on commit 5ce36c0

Please sign in to comment.