Commit a9361a15 authored by Mohamed Amir Yosef's avatar Mohamed Amir Yosef Committed by Commit Bot

[Passwords] Introduce OnGetCompromisedCredentialsFrom() in ...

... in CompromisedCredentialsConsumer.
This is similar to OnGetCompromisedCredentials(), but also receives
the  originating PasswordStore as a parameter.

Bug: 1108422
Change-Id: Icc4e8135f4181b17f23fbee23666d20ad4f04277
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2367717
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800545}
parent 35ae643e
...@@ -12,4 +12,10 @@ CompromisedCredentialsConsumer::CompromisedCredentialsConsumer() = default; ...@@ -12,4 +12,10 @@ CompromisedCredentialsConsumer::CompromisedCredentialsConsumer() = default;
CompromisedCredentialsConsumer::~CompromisedCredentialsConsumer() = default; CompromisedCredentialsConsumer::~CompromisedCredentialsConsumer() = default;
void CompromisedCredentialsConsumer::OnGetCompromisedCredentialsFrom(
PasswordStore* store,
std::vector<CompromisedCredentials> compromised_credentials) {
OnGetCompromisedCredentials(std::move(compromised_credentials));
}
} // namespace password_manager } // namespace password_manager
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
namespace password_manager { namespace password_manager {
struct CompromisedCredentials; struct CompromisedCredentials;
class PasswordStore;
// Reads information associated with compromised credentials history from the // Reads information associated with compromised credentials history from the
// PasswordStore. Reads are done asynchronously on a separate thread. It // PasswordStore. Reads are done asynchronously on a separate thread. It
...@@ -27,6 +28,15 @@ class CompromisedCredentialsConsumer { ...@@ -27,6 +28,15 @@ class CompromisedCredentialsConsumer {
virtual void OnGetCompromisedCredentials( virtual void OnGetCompromisedCredentials(
std::vector<CompromisedCredentials> compromised_credentials) = 0; std::vector<CompromisedCredentials> compromised_credentials) = 0;
// Like OnGetCompromisedCredentials(), but also receives the originating
// PasswordStore as a parameter. This is useful for consumers that query
// both the profile-scoped and the account-scoped store. The default
// implementation simply calls OnGetCompromisedCredentials(), so consumers
// that don't care about the store can just ignore this.
virtual void OnGetCompromisedCredentialsFrom(
PasswordStore* store,
std::vector<CompromisedCredentials> compromised_credentials);
// The base::CancelableTaskTracker can be used for cancelling the tasks // The base::CancelableTaskTracker can be used for cancelling the tasks
// associated with the consumer. // associated with the consumer.
base::CancelableTaskTracker* cancelable_task_tracker() { base::CancelableTaskTracker* cancelable_task_tracker() {
......
...@@ -933,8 +933,8 @@ void PasswordStore::PostCompromisedCredentialsTaskAndReplyToConsumerWithResult( ...@@ -933,8 +933,8 @@ void PasswordStore::PostCompromisedCredentialsTaskAndReplyToConsumerWithResult(
consumer->cancelable_task_tracker()->PostTaskAndReplyWithResult( consumer->cancelable_task_tracker()->PostTaskAndReplyWithResult(
background_task_runner_.get(), FROM_HERE, std::move(task), background_task_runner_.get(), FROM_HERE, std::move(task),
base::BindOnce( base::BindOnce(
&CompromisedCredentialsConsumer::OnGetCompromisedCredentials, &CompromisedCredentialsConsumer::OnGetCompromisedCredentialsFrom,
consumer->GetWeakPtr())); consumer->GetWeakPtr(), base::RetainedRef(this)));
} }
void PasswordStore::AddLoginInternal(const PasswordForm& form) { void PasswordStore::AddLoginInternal(const PasswordForm& form) {
......
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