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

[Passwords] Introduce MultiStorePasswordSaveManager::Unblacklist()

Bug: 1012203
Change-Id: I469a9dd2a96d8c50e88e43aa1f2ac06369d9e7f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1940167
Commit-Queue: Mohamed Amir Yosef <mamir@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720165}
parent d65e44ba
......@@ -62,6 +62,24 @@ void MultiStorePasswordSaveManager::UpdateInternal(
}
}
void MultiStorePasswordSaveManager::PermanentlyBlacklist(
const PasswordStore::FormDigest& form_digest) {
DCHECK(!client_->IsIncognito());
PasswordSaveManagerImpl::PermanentlyBlacklist(form_digest);
// TODO(crbug.com/1012203): Implement this using the the stored pref
// indicating the default store selected by the user.
}
void MultiStorePasswordSaveManager::Unblacklist(
const PasswordStore::FormDigest& form_digest) {
// Try to unblacklist in both stores anyway because if credentials don't
// exist, the unblacklist operation is no-op.
form_saver_->Unblacklist(form_digest);
if (account_store_form_saver_ && IsAccountStoreActive()) {
account_store_form_saver_->Unblacklist(form_digest);
}
}
bool MultiStorePasswordSaveManager::IsAccountStoreActive() {
return client_->GetPasswordSyncState() ==
password_manager::ACCOUNT_PASSWORDS_ACTIVE_NORMAL_ENCRYPTION;
......
......@@ -39,6 +39,10 @@ class MultiStorePasswordSaveManager : public PasswordSaveManagerImpl {
const std::vector<const autofill::PasswordForm*>& matches,
const base::string16& old_password) override;
void PermanentlyBlacklist(
const PasswordStore::FormDigest& form_digest) override;
void Unblacklist(const PasswordStore::FormDigest& form_digest) override;
protected:
FormSaver* GetFormSaverForGeneration() override;
......
......@@ -454,4 +454,14 @@ TEST_F(MultiStorePasswordSaveManagerTest,
password_save_manager()->Save(observed_form_, saved_match_);
}
TEST_F(MultiStorePasswordSaveManagerTest, UnblacklistInBothStores) {
SetAccountStoreActive(/*is_active=*/true);
const PasswordStore::FormDigest form_digest(saved_match_);
EXPECT_CALL(*mock_profile_form_saver(), Unblacklist(form_digest));
EXPECT_CALL(*mock_account_form_saver(), Unblacklist(form_digest));
password_save_manager()->Unblacklist(form_digest);
}
} // namespace password_manager
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