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

Convert c/b/profiles/, c/b/safe_browsing/ to OnPrimaryAccountChanged()

Methods OnUnconsentedPrimaryAccountChanged is deprecated, so this CL
changes the chrome/browser/profiles/* and c/b/safe_browsing/* to
override the method OnPrimaryAccountChanged().

Bug: 1163126
Change-Id: I0dbabb38085373cf44de5f7273812d4f44fe7969
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611091Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840655}
parent eeb45c9b
...@@ -155,12 +155,17 @@ void GAIAInfoUpdateService::Shutdown() { ...@@ -155,12 +155,17 @@ void GAIAInfoUpdateService::Shutdown() {
identity_manager_->RemoveObserver(this); identity_manager_->RemoveObserver(this);
} }
void GAIAInfoUpdateService::OnUnconsentedPrimaryAccountChanged( void GAIAInfoUpdateService::OnPrimaryAccountChanged(
const CoreAccountInfo& unconsented_primary_account_info) { const signin::PrimaryAccountChangeEvent& event) {
if (unconsented_primary_account_info.gaia.empty()) { switch (event.GetEventTypeFor(signin::ConsentLevel::kNotRequired)) {
ClearProfileEntry(); case signin::PrimaryAccountChangeEvent::Type::kSet:
} else { UpdatePrimaryAccount();
UpdatePrimaryAccount(); break;
case signin::PrimaryAccountChangeEvent::Type::kCleared:
ClearProfileEntry();
break;
case signin::PrimaryAccountChangeEvent::Type::kNone:
break;
} }
} }
......
...@@ -48,8 +48,8 @@ class GAIAInfoUpdateService : public KeyedService, ...@@ -48,8 +48,8 @@ class GAIAInfoUpdateService : public KeyedService,
void UpdateAnyAccount(const AccountInfo& info); void UpdateAnyAccount(const AccountInfo& info);
// Overridden from signin::IdentityManager::Observer: // Overridden from signin::IdentityManager::Observer:
void OnUnconsentedPrimaryAccountChanged( void OnPrimaryAccountChanged(
const CoreAccountInfo& unconsented_primary_account_info) override; const signin::PrimaryAccountChangeEvent& event) override;
void OnExtendedAccountInfoUpdated(const AccountInfo& info) override; void OnExtendedAccountInfoUpdated(const AccountInfo& info) override;
void OnAccountsInCookieUpdated( void OnAccountsInCookieUpdated(
const signin::AccountsInCookieJarInfo& accounts_in_cookie_jar_info, const signin::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
......
...@@ -123,14 +123,24 @@ void AdvancedProtectionStatusManager::OnExtendedAccountInfoRemoved( ...@@ -123,14 +123,24 @@ void AdvancedProtectionStatusManager::OnExtendedAccountInfoRemoved(
} }
} }
void AdvancedProtectionStatusManager::OnUnconsentedPrimaryAccountChanged( void AdvancedProtectionStatusManager::OnPrimaryAccountChanged(
const CoreAccountInfo& account_info) { const signin::PrimaryAccountChangeEvent& event) {
// TODO(crbug.com/926204): remove IdentityManager ensures that primary account switch (event.GetEventTypeFor(signin::ConsentLevel::kNotRequired)) {
// always has valid refresh token when it is set. case signin::PrimaryAccountChangeEvent::Type::kSet: {
if (account_info.is_under_advanced_protection) // TODO(crbug.com/926204): remove IdentityManager ensures that primary
OnAdvancedProtectionEnabled(); // account always has valid refresh token when it is set.
else if (event.GetCurrentState().primary_account.is_under_advanced_protection)
OnAdvancedProtectionDisabled(); OnAdvancedProtectionEnabled();
else
OnAdvancedProtectionDisabled();
break;
}
case signin::PrimaryAccountChangeEvent::Type::kCleared:
OnAdvancedProtectionDisabled();
break;
case signin::PrimaryAccountChangeEvent::Type::kNone:
break;
}
} }
void AdvancedProtectionStatusManager::OnAdvancedProtectionEnabled() { void AdvancedProtectionStatusManager::OnAdvancedProtectionEnabled() {
......
...@@ -85,8 +85,8 @@ class AdvancedProtectionStatusManager ...@@ -85,8 +85,8 @@ class AdvancedProtectionStatusManager
void UnsubscribeFromSigninEvents(); void UnsubscribeFromSigninEvents();
// IdentityManager::Observer implementations. // IdentityManager::Observer implementations.
void OnUnconsentedPrimaryAccountChanged( void OnPrimaryAccountChanged(
const CoreAccountInfo& account_info) override; const signin::PrimaryAccountChangeEvent& event) override;
void OnExtendedAccountInfoUpdated(const AccountInfo& info) override; void OnExtendedAccountInfoUpdated(const AccountInfo& info) override;
void OnExtendedAccountInfoRemoved(const AccountInfo& info) override; void OnExtendedAccountInfoRemoved(const AccountInfo& info) override;
......
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