Commit 7ce0bebc authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Chromium LUCI CQ

Convert components/password_manager/core/* to OnPrimaryAccountChanged()

Method OnPrimaryAccountCleared is deprecated. So this cl changes
these calls to OnPrimaryAccountChanged()

Bug: 1158855
Change-Id: I56ea44e66fdd91f9cf81eae822233d792e6927c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622532Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842962}
parent 19e75e67
......@@ -48,9 +48,13 @@ void PasswordStoreSigninNotifierImpl::NotifySignedOut(
}
// IdentityManager::Observer implementation.
void PasswordStoreSigninNotifierImpl::OnPrimaryAccountCleared(
const CoreAccountInfo& account_info) {
NotifySignedOut(account_info.email, /* primary_account= */ true);
void PasswordStoreSigninNotifierImpl::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) {
if (event.GetEventTypeFor(signin::ConsentLevel::kSync) ==
signin::PrimaryAccountChangeEvent::Type::kCleared) {
NotifySignedOut(event.GetPreviousState().primary_account.email,
/* primary_account= */ true);
}
}
// IdentityManager::Observer implementation.
......
......@@ -32,7 +32,8 @@ class PasswordStoreSigninNotifierImpl
void UnsubscribeFromSigninEvents() override;
// IdentityManager::Observer implementations.
void OnPrimaryAccountCleared(const CoreAccountInfo& account_info) override;
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override;
void OnExtendedAccountInfoRemoved(const AccountInfo& info) override;
private:
......
......@@ -183,15 +183,18 @@ void PasswordModelTypeController::OnAccountsCookieDeletedByUserAction() {
features_util::ClearAccountStorageSettingsForAllUsers(pref_service_);
}
void PasswordModelTypeController::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) {
// Note: OnPrimaryAccountCleared() basically means that the consent for
// Sync-the-feature was revoked. In this case, also clear any possible
// matching opt-in for the account-scoped storage, since it'd probably be
// surprising to the user if their account passwords still remained after
// disabling Sync.
features_util::OptOutOfAccountStorageAndClearSettingsForAccount(
pref_service_, previous_primary_account_info.gaia);
void PasswordModelTypeController::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) {
if (event.GetEventTypeFor(signin::ConsentLevel::kSync) ==
signin::PrimaryAccountChangeEvent::Type::kCleared) {
// Note: kCleared event for ConsentLevel::kSync basically means that the
// consent for Sync-the-feature was revoked. In this case, also clear any
// possible matching opt-in for the account-scoped storage, since it'd
// probably be surprising to the user if their account passwords still
// remained after disabling Sync.
features_util::OptOutOfAccountStorageAndClearSettingsForAccount(
pref_service_, event.GetPreviousState().primary_account.gaia);
}
}
void PasswordModelTypeController::OnOptInStateMaybeChanged() {
......
......@@ -59,8 +59,8 @@ class PasswordModelTypeController : public syncer::ModelTypeController,
const signin::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
const GoogleServiceAuthError& error) override;
void OnAccountsCookieDeletedByUserAction() override;
void OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) override;
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override;
private:
void OnOptInStateMaybeChanged();
......
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