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

Remove OnPrimaryAccount{Set|Cleared}

The methods OnPrimaryAccount{Set|Cleared} were replaced by
OnPrimaryAccountChanged(). This CL removes them.

Bug: 1158855
Change-Id: I7652904a299a9edbffb5d1ff078c54f0f1cbeb66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627390
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843566}
parent e91d21ce
......@@ -478,18 +478,6 @@ AccountInfo IdentityManager::GetAccountInfoForAccountWithRefreshToken(
void IdentityManager::OnPrimaryAccountChanged(
const PrimaryAccountChangeEvent& event_details) {
// TODO(crbug.com/1158855): Remove this switch statement once all observers
// are converted to OnPrimaryAccountChanged().
switch (event_details.GetEventTypeFor(ConsentLevel::kSync)) {
case PrimaryAccountChangeEvent::Type::kSet:
break;
case PrimaryAccountChangeEvent::Type::kCleared:
FirePrimaryAccountCleared(event_details);
break;
case PrimaryAccountChangeEvent::Type::kNone:
break;
}
for (auto& observer : observer_list_)
observer.OnPrimaryAccountChanged(event_details);
......@@ -510,17 +498,6 @@ void IdentityManager::OnPrimaryAccountChanged(
}
}
void IdentityManager::FirePrimaryAccountCleared(
const PrimaryAccountChangeEvent& event_details) {
const CoreAccountInfo& account_info =
event_details.GetPreviousState().primary_account;
DCHECK(!HasPrimaryAccount());
DCHECK(!account_info.IsEmpty());
for (auto& observer : observer_list_) {
observer.OnPrimaryAccountCleared(account_info);
}
}
void IdentityManager::OnRefreshTokenAvailable(const CoreAccountId& account_id) {
CoreAccountInfo account_info =
GetAccountInfoForAccountWithRefreshToken(account_id);
......
......@@ -80,13 +80,6 @@ class IdentityManager : public KeyedService,
virtual void OnPrimaryAccountChanged(
const PrimaryAccountChangeEvent& event_details) {}
// Called when the user moves from having a primary account to no longer
// having a primary account (note that the user may still have an
// *unconsented* primary account after this event; see./README.md).
// DEPRECATED: Use OnPrimaryAccountChanged() instead.
virtual void OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) {}
// TODO(crbug.com/1046746): Move to |SigninClient|.
// Called After notifying all the observers of |OnPrimaryAccountChanged|
// if the sync primary account was cleared.
......@@ -654,12 +647,6 @@ class IdentityManager : public KeyedService,
void OnAccountUpdated(const AccountInfo& info);
void OnAccountRemoved(const AccountInfo& info);
// Fire the deprecated observer methods for settings and clearing the primary
// account.
void FirePrimaryAccountSet(const PrimaryAccountChangeEvent& event_details);
void FirePrimaryAccountCleared(
const PrimaryAccountChangeEvent& event_details);
// Backing signin classes.
std::unique_ptr<AccountTrackerService> account_tracker_service_;
std::unique_ptr<ProfileOAuth2TokenService> token_service_;
......
......@@ -67,8 +67,13 @@ class ClearPrimaryAccountTestObserver
}
// signin::IdentityManager::Observer implementation.
void OnPrimaryAccountCleared(const CoreAccountInfo& account_info) override {
on_primary_account_cleared_.Run(account_info);
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override {
if (event.GetEventTypeFor(signin::ConsentLevel::kSync) !=
signin::PrimaryAccountChangeEvent::Type::kCleared) {
return;
}
on_primary_account_cleared_.Run(event.GetPreviousState().primary_account);
}
void OnRefreshTokenRemovedForAccount(
......
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