Commit 76306c32 authored by Eleonora Rocchi's avatar Eleonora Rocchi Committed by Commit Bot

[PwdCheckAndroid] Update status on compromised credentials change

This CL add the update of the status header if the compromised
credentials shown have been updated.

Bug: 1117543, 1092444
Change-Id: I8dbf4210385bfc3c0842c55b65913fe15be1e3e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2366725
Commit-Queue: Eleonora Rocchi <erocchi@google.com>
Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800204}
parent 482eda12
......@@ -97,6 +97,7 @@ class PasswordCheckMediator
}
if (items.size() > 1) items.removeRange(1, items.size() - 1);
updateStatusHeaderWhenCredentialsChange();
for (CompromisedCredential credential : credentialsList) {
items.add(createEntryForCredential(credential));
}
......@@ -158,6 +159,7 @@ class PasswordCheckMediator
assert leakedCredential != null;
ListModel<ListItem> items = mModel.get(ITEMS);
assert items.size() >= 1 : "Needs to initialize list with header before adding items!";
updateStatusHeaderWhenCredentialsChange();
items.add(createEntryForCredential(leakedCredential));
}
......@@ -230,6 +232,17 @@ class PasswordCheckMediator
mChangePasswordDelegate.launchCctWithScript(credential);
}
private void updateStatusHeaderWhenCredentialsChange() {
ListModel<ListItem> items = mModel.get(ITEMS);
assert items.size() >= 1;
PropertyModel header = items.get(0).model;
if (header.get(CHECK_STATUS) == PasswordCheckUIStatus.IDLE) {
header.set(COMPROMISED_CREDENTIALS_COUNT,
Integer.valueOf(getPasswordCheck().getCompromisedCredentialsCount()));
}
}
private void runCheck() {
getPasswordCheck().startCheck();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment