Commit 766a1393 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

[Passwords] Rename PasswordLeakHistoryConsumer to CompromisedCredentialsConsumer

Similarly to r714618 this change renames PasswordLeakHistoryConsumer to
CompromisedCredentialsConsumer to better reflect the actual usage of the
class.

Bug: 1047726
Change-Id: I7f2691e0eb2a4dc6dc5e16ca11cdc1e2baea6b13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2039250
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738618}
parent 685e4608
......@@ -66,6 +66,8 @@ jumbo_static_library("browser") {
"biometric_authenticator.h",
"browser_save_password_progress_logger.cc",
"browser_save_password_progress_logger.h",
"compromised_credentials_consumer.cc",
"compromised_credentials_consumer.h",
"compromised_credentials_observer.cc",
"compromised_credentials_observer.h",
"compromised_credentials_table.cc",
......@@ -155,8 +157,6 @@ jumbo_static_library("browser") {
"password_generation_frame_helper.h",
"password_generation_manager.cc",
"password_generation_manager.h",
"password_leak_history_consumer.cc",
"password_leak_history_consumer.h",
"password_list_sorter.cc",
"password_list_sorter.h",
"password_manager.cc",
......
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/password_manager/core/browser/password_leak_history_consumer.h"
#include "components/password_manager/core/browser/compromised_credentials_consumer.h"
#include "components/password_manager/core/browser/compromised_credentials_table.h"
namespace password_manager {
PasswordLeakHistoryConsumer::PasswordLeakHistoryConsumer() = default;
CompromisedCredentialsConsumer::CompromisedCredentialsConsumer() = default;
PasswordLeakHistoryConsumer::~PasswordLeakHistoryConsumer() = default;
CompromisedCredentialsConsumer::~CompromisedCredentialsConsumer() = default;
} // namespace password_manager
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_LEAK_HISTORY_CONSUMER_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_LEAK_HISTORY_CONSUMER_H_
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_COMPROMISED_CREDENTIALS_CONSUMER_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_COMPROMISED_CREDENTIALS_CONSUMER_H_
#include <vector>
......@@ -18,9 +18,9 @@ struct CompromisedCredentials;
// provides the virtual callback method, which is guaranteed to be executed on
// this (the UI) thread. It also provides the base::CancelableTaskTracker
// member, which cancels any outstanding tasks upon destruction.
class PasswordLeakHistoryConsumer {
class CompromisedCredentialsConsumer {
public:
PasswordLeakHistoryConsumer();
CompromisedCredentialsConsumer();
// Called when the GetAllCompromisedCredentials() request is finished, with
// the associated |compromised_credentials|.
......@@ -33,18 +33,18 @@ class PasswordLeakHistoryConsumer {
return &cancelable_task_tracker_;
}
base::WeakPtr<PasswordLeakHistoryConsumer> GetWeakPtr() {
base::WeakPtr<CompromisedCredentialsConsumer> GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
protected:
virtual ~PasswordLeakHistoryConsumer();
virtual ~CompromisedCredentialsConsumer();
private:
base::CancelableTaskTracker cancelable_task_tracker_;
base::WeakPtrFactory<PasswordLeakHistoryConsumer> weak_ptr_factory_{this};
base::WeakPtrFactory<CompromisedCredentialsConsumer> weak_ptr_factory_{this};
};
} // namespace password_manager
#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_LEAK_HISTORY_CONSUMER_H_
#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_COMPROMISED_CREDENTIALS_CONSUMER_H_
......@@ -25,10 +25,10 @@
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/android_affiliation/affiliated_match_helper.h"
#include "components/password_manager/core/browser/compromised_credentials_consumer.h"
#include "components/password_manager/core/browser/compromised_credentials_observer.h"
#include "components/password_manager/core/browser/compromised_credentials_table.h"
#include "components/password_manager/core/browser/field_info_table.h"
#include "components/password_manager/core/browser/password_leak_history_consumer.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_manager_util.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
......@@ -387,7 +387,7 @@ void PasswordStore::RemoveCompromisedCredentials(
}
void PasswordStore::GetAllCompromisedCredentials(
PasswordLeakHistoryConsumer* consumer) {
CompromisedCredentialsConsumer* consumer) {
DCHECK(main_task_runner_->RunsTasksInCurrentSequence());
PostCompromisedCredentialsTaskAndReplyToConsumerWithResult(
consumer,
......@@ -807,12 +807,13 @@ void PasswordStore::PostStatsTaskAndReplyToConsumerWithResult(
}
void PasswordStore::PostCompromisedCredentialsTaskAndReplyToConsumerWithResult(
PasswordLeakHistoryConsumer* consumer,
CompromisedCredentialsConsumer* consumer,
CompromisedCredentialsTask task) {
consumer->cancelable_task_tracker()->PostTaskAndReplyWithResult(
background_task_runner_.get(), FROM_HERE, std::move(task),
base::BindOnce(&PasswordLeakHistoryConsumer::OnGetCompromisedCredentials,
consumer->GetWeakPtr()));
base::BindOnce(
&CompromisedCredentialsConsumer::OnGetCompromisedCredentials,
consumer->GetWeakPtr()));
}
void PasswordStore::AddLoginInternal(const PasswordForm& form) {
......
......@@ -56,7 +56,7 @@ using metrics_util::GaiaPasswordHashChange;
class AffiliatedMatchHelper;
class CompromisedCredentialsObserver;
class PasswordStoreConsumer;
class PasswordLeakHistoryConsumer;
class CompromisedCredentialsConsumer;
class PasswordStoreSigninNotifier;
class PasswordSyncableService;
class PasswordSyncBridge;
......@@ -259,7 +259,7 @@ class PasswordStore : protected PasswordStoreSync,
// Retrieves all compromised credentials and notifies |consumer| on
// completion. The request will be cancelled if the consumer is destroyed.
void GetAllCompromisedCredentials(PasswordLeakHistoryConsumer* consumer);
void GetAllCompromisedCredentials(CompromisedCredentialsConsumer* consumer);
// Removes all compromised credentials in the given date range. If
// |url_filter| is not null, only compromised credentials for matching urls
......@@ -622,7 +622,7 @@ class PasswordStore : protected PasswordStoreSync,
// Invokes |consumer|->OnGetCompromisedCredentials() on the caller's thread
// with the result.
void PostCompromisedCredentialsTaskAndReplyToConsumerWithResult(
PasswordLeakHistoryConsumer* consumer,
CompromisedCredentialsConsumer* consumer,
CompromisedCredentialsTask task);
// The following methods notify observers that the password store may have
......
......@@ -22,8 +22,8 @@
#include "components/password_manager/core/browser/android_affiliation/affiliated_match_helper.h"
#include "components/password_manager/core/browser/android_affiliation/affiliation_service.h"
#include "components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.h"
#include "components/password_manager/core/browser/compromised_credentials_consumer.h"
#include "components/password_manager/core/browser/form_parsing/form_parser.h"
#include "components/password_manager/core/browser/password_leak_history_consumer.h"
#include "components/password_manager/core/browser/password_manager_test_utils.h"
#include "components/password_manager/core/browser/password_reuse_detector.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
......@@ -79,15 +79,16 @@ constexpr const char kTestAndroidIconURL1[] = "https://example.com/icon_1.png";
constexpr const char kTestAndroidName2[] = "Example Android App 2";
constexpr const char kTestAndroidIconURL2[] = "https://example.com/icon_2.png";
class MockPasswordLeakHistoryConsumer : public PasswordLeakHistoryConsumer {
class MockCompromisedCredentialsConsumer
: public CompromisedCredentialsConsumer {
public:
MockPasswordLeakHistoryConsumer() = default;
MockCompromisedCredentialsConsumer() = default;
MOCK_METHOD1(OnGetCompromisedCredentials,
void(std::vector<CompromisedCredentials>));
private:
DISALLOW_COPY_AND_ASSIGN(MockPasswordLeakHistoryConsumer);
DISALLOW_COPY_AND_ASSIGN(MockCompromisedCredentialsConsumer);
};
class MockPasswordStoreConsumer : public PasswordStoreConsumer {
......@@ -401,7 +402,7 @@ TEST_F(PasswordStoreTest, CompromisedCredentialsObserverOnRemoveLogin) {
store->AddLogin(*test_form);
WaitForPasswordStore();
MockPasswordLeakHistoryConsumer consumer;
MockCompromisedCredentialsConsumer consumer;
base::RunLoop run_loop;
store->RemoveLoginsCreatedBetween(base::Time::FromDoubleT(0),
base::Time::FromDoubleT(2),
......@@ -443,7 +444,7 @@ TEST_F(PasswordStoreTest, CompromisedCredentialsObserverOnLoginUpdated) {
store->AddLogin(*test_form);
WaitForPasswordStore();
MockPasswordLeakHistoryConsumer consumer;
MockCompromisedCredentialsConsumer consumer;
kTestCredential.password_value = L"password_value_2";
std::unique_ptr<PasswordForm> test_form_2(
FillPasswordFormWithData(kTestCredential));
......@@ -485,7 +486,7 @@ TEST_F(PasswordStoreTest, CompromisedCredentialsObserverOnLoginAdded) {
store->AddLogin(*test_form);
WaitForPasswordStore();
MockPasswordLeakHistoryConsumer consumer;
MockCompromisedCredentialsConsumer consumer;
kTestCredential.password_value = L"password_value_2";
std::unique_ptr<PasswordForm> test_form_2(
FillPasswordFormWithData(kTestCredential));
......@@ -1400,7 +1401,7 @@ TEST_F(PasswordStoreTest, GetAllCompromisedCredentials) {
store->AddCompromisedCredentials(compromised_credentials);
store->AddCompromisedCredentials(compromised_credentials2);
MockPasswordLeakHistoryConsumer consumer;
MockCompromisedCredentialsConsumer consumer;
EXPECT_CALL(consumer,
OnGetCompromisedCredentials(UnorderedElementsAre(
compromised_credentials, compromised_credentials2)));
......@@ -1439,7 +1440,7 @@ TEST_F(PasswordStoreTest, RemoveCompromisedCredentialsCreatedBetween) {
store->AddCompromisedCredentials(compromised_credentials2);
store->AddCompromisedCredentials(compromised_credentials3);
MockPasswordLeakHistoryConsumer consumer;
MockCompromisedCredentialsConsumer consumer;
EXPECT_CALL(consumer, OnGetCompromisedCredentials(UnorderedElementsAre(
compromised_credentials1, compromised_credentials2,
compromised_credentials3)));
......
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