Commit 060fc3e9 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Chromium LUCI CQ

Convert signin_profile_attributes_updater to OnPrimaryAccountChanged()

Methods OnPrimaryAccountSet/Cleared() are deprecated, so this CL changes
the signin_profile_attributes_updater.(h|ccc} to override the method
OnPrimaryAccountChanged().

Note that is also have a slight change of behavior by updating the auth
info even when the unconsent primary account changed.

Bug: 1163126
Change-Id: I5f1c739787e3ead98c8dcedc7ca486eeda2bc216
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611717Reviewed-by: default avatarMonica Basta <msalama@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840634}
parent 08f4acc3
...@@ -67,12 +67,14 @@ void SigninProfileAttributesUpdater::UpdateProfileAttributes() { ...@@ -67,12 +67,14 @@ void SigninProfileAttributesUpdater::UpdateProfileAttributes() {
if (clear_profile) { if (clear_profile) {
entry->SetLocalAuthCredentials(std::string()); entry->SetLocalAuthCredentials(std::string());
entry->SetAuthInfo(std::string(), base::string16(), false); entry->SetAuthInfo(std::string(), base::string16(),
/*is_consented_primary_account=*/false);
if (!signin_util::IsForceSigninEnabled()) if (!signin_util::IsForceSigninEnabled())
entry->SetIsSigninRequired(false); entry->SetIsSigninRequired(false);
} else { } else {
entry->SetAuthInfo(account_info.gaia, base::UTF8ToUTF16(account_info.email), entry->SetAuthInfo(
identity_manager_->HasPrimaryAccount()); account_info.gaia, base::UTF8ToUTF16(account_info.email),
identity_manager_->HasPrimaryAccount(signin::ConsentLevel::kSync));
} }
} }
...@@ -86,20 +88,7 @@ void SigninProfileAttributesUpdater::OnErrorChanged() { ...@@ -86,20 +88,7 @@ void SigninProfileAttributesUpdater::OnErrorChanged() {
entry->SetIsAuthError(signin_error_controller_->HasError()); entry->SetIsAuthError(signin_error_controller_->HasError());
} }
void SigninProfileAttributesUpdater::OnPrimaryAccountSet( void SigninProfileAttributesUpdater::OnPrimaryAccountChanged(
const CoreAccountInfo& primary_account_info) { const signin::PrimaryAccountChangeEvent& event) {
UpdateProfileAttributes();
}
void SigninProfileAttributesUpdater::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) {
UpdateProfileAttributes();
}
void SigninProfileAttributesUpdater::OnUnconsentedPrimaryAccountChanged(
const CoreAccountInfo& unconsented_primary_account_info) {
if (identity_manager_->HasPrimaryAccount())
return;
UpdateProfileAttributes(); UpdateProfileAttributes();
} }
...@@ -42,12 +42,8 @@ class SigninProfileAttributesUpdater ...@@ -42,12 +42,8 @@ class SigninProfileAttributesUpdater
void OnErrorChanged() override; void OnErrorChanged() override;
// IdentityManager::Observer: // IdentityManager::Observer:
void OnPrimaryAccountSet( void OnPrimaryAccountChanged(
const CoreAccountInfo& primary_account_info) override; const signin::PrimaryAccountChangeEvent& event) override;
void OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) override;
void OnUnconsentedPrimaryAccountChanged(
const CoreAccountInfo& unconsented_primary_account_info) override;
signin::IdentityManager* identity_manager_; signin::IdentityManager* identity_manager_;
SigninErrorController* signin_error_controller_; SigninErrorController* signin_error_controller_;
......
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