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