Commit 19a1eb55 authored by Eleonora Rocchi's avatar Eleonora Rocchi Committed by Commit Bot

[PwdCheckAndroid] Retrieve the timestamp of the last check from

PasswordCheckBridge.

This CL adds an empty method to the bridge to retrieve the timestamp of
the last completed password check. It also adds the logic to call this
method from PasswordCheckMediator.

Bug: 1109691, 1092444
Change-Id: Ibaa0993e11271b4ae0ee8287a86a51e7023f3bc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343268
Commit-Queue: Eleonora Rocchi <erocchi@google.com>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795962}
parent 490dd17d
......@@ -98,6 +98,14 @@ class PasswordCheckBridge {
PasswordCheckBridgeJni.get().stopCheck(mNativePasswordCheckBridge);
}
/**
* @return The timestamp of the last completed check.
*/
long getCheckTimestamp() {
// TODO(crbug.com/1102025): Add method to retrieve the timestamp.
return 0L;
}
/**
* This can return 0 if the compromised credentials haven't been fetched from the database yet.
* @return The number of compromised credentials found in the last run password check.
......
......@@ -95,6 +95,11 @@ class PasswordCheckImpl implements PasswordCheck, PasswordCheckObserver {
mObserverList.removeObserver(obs);
}
@Override
public long getCheckTimestamp() {
return mPasswordCheckBridge.getCheckTimestamp();
}
@Override
public int getCompromisedCredentialsCount() {
return mPasswordCheckBridge.getCompromisedCredentialsCount();
......
......@@ -103,8 +103,7 @@ class PasswordCheckMediator
Integer compromisedCredentialCount = null;
if (status == PasswordCheckUIStatus.IDLE) {
compromisedCredentialCount = getPasswordCheck().getCompromisedCredentialsCount();
// TODO(crbug.com/1109691): Retrieve the timestamp of the last check from the bridge.
checkTimestamp = 0L;
checkTimestamp = getPasswordCheck().getCheckTimestamp();
}
header.set(CHECK_TIMESTAMP, checkTimestamp);
header.set(COMPROMISED_CREDENTIALS_COUNT, compromisedCredentialCount);
......
......@@ -70,6 +70,11 @@ public interface PasswordCheck extends PasswordCheckComponentUi.Delegate {
*/
void removeObserver(Observer obs);
/**
* @return The timestamp of the last completed check.
*/
long getCheckTimestamp();
/**
* @return The latest available number of compromised passwords. If this is invoked before
* {@link Observer#onCompromisedCredentialsFetchCompleted}, the returned value is likely
......
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