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

Convert c/b/ui/webui/settings/ to OnPrimaryAccountChanged()

Methods OnPrimaryAccountSet/Cleared() are deprecated, so this CL changes
the chrome/browser/ui/webui/settings/* to override the method
OnPrimaryAccountChanged().

Bug: 1163126
Change-Id: I423bf0ec29479c7942c4e4c5558f9e6ba68b3ad4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611267Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841437}
parent 00e8ebec
......@@ -817,22 +817,26 @@ void PeopleHandler::FocusUI() {
web_contents->GetDelegate()->ActivateContents(web_contents);
}
void PeopleHandler::OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) {
void PeopleHandler::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) {
switch (event.GetEventTypeFor(signin::ConsentLevel::kSync)) {
case signin::PrimaryAccountChangeEvent::Type::kSet: {
// After a primary account was set, the Sync setup will start soon. Grab a
// SetupInProgressHandle right now to avoid a temporary "missing Sync
// confirmation" error in the avatar menu. See crbug.com/928696.
syncer::SyncService* service = GetSyncService();
if (service && !sync_blocker_)
sync_blocker_ = service->GetSetupInProgressHandle();
UpdateSyncStatus();
}
void PeopleHandler::OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) {
return;
}
case signin::PrimaryAccountChangeEvent::Type::kCleared:
sync_blocker_.reset();
UpdateSyncStatus();
return;
case signin::PrimaryAccountChangeEvent::Type::kNone:
return;
}
}
void PeopleHandler::OnStateChanged(syncer::SyncService* sync) {
......
......@@ -126,10 +126,8 @@ class PeopleHandler : public SettingsPageUIHandler,
void FocusUI() override;
// IdentityManager::Observer implementation.
void OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) override;
void OnPrimaryAccountCleared(
const CoreAccountInfo& previous_primary_account_info) override;
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override;
void OnExtendedAccountInfoUpdated(const AccountInfo& info) override;
void OnExtendedAccountInfoRemoved(const AccountInfo& info) override;
......
......@@ -83,9 +83,14 @@ class SignInObserver : public signin::IdentityManager::Observer {
FAIL() << "Sign in observer timed out!";
}
void OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) override {
DVLOG(1) << "Google signin succeeded.";
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event) override {
if (event.GetEventTypeFor(signin::ConsentLevel::kSync) !=
signin::PrimaryAccountChangeEvent::Type::kSet) {
return;
}
DVLOG(1) << "Sign in finished: Sync primary account was set.";
signed_in_ = true;
QuitLoopRunner();
}
......
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