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() { ...@@ -817,22 +817,26 @@ void PeopleHandler::FocusUI() {
web_contents->GetDelegate()->ActivateContents(web_contents); web_contents->GetDelegate()->ActivateContents(web_contents);
} }
void PeopleHandler::OnPrimaryAccountSet( void PeopleHandler::OnPrimaryAccountChanged(
const CoreAccountInfo& primary_account_info) { const signin::PrimaryAccountChangeEvent& event) {
// After a primary account was set, the Sync setup will start soon. Grab a switch (event.GetEventTypeFor(signin::ConsentLevel::kSync)) {
// SetupInProgressHandle right now to avoid a temporary "missing Sync case signin::PrimaryAccountChangeEvent::Type::kSet: {
// confirmation" error in the avatar menu. See crbug.com/928696. // After a primary account was set, the Sync setup will start soon. Grab a
syncer::SyncService* service = GetSyncService(); // SetupInProgressHandle right now to avoid a temporary "missing Sync
if (service && !sync_blocker_) // confirmation" error in the avatar menu. See crbug.com/928696.
sync_blocker_ = service->GetSetupInProgressHandle(); syncer::SyncService* service = GetSyncService();
if (service && !sync_blocker_)
UpdateSyncStatus(); sync_blocker_ = service->GetSetupInProgressHandle();
} UpdateSyncStatus();
return;
void PeopleHandler::OnPrimaryAccountCleared( }
const CoreAccountInfo& previous_primary_account_info) { case signin::PrimaryAccountChangeEvent::Type::kCleared:
sync_blocker_.reset(); sync_blocker_.reset();
UpdateSyncStatus(); UpdateSyncStatus();
return;
case signin::PrimaryAccountChangeEvent::Type::kNone:
return;
}
} }
void PeopleHandler::OnStateChanged(syncer::SyncService* sync) { void PeopleHandler::OnStateChanged(syncer::SyncService* sync) {
......
...@@ -126,10 +126,8 @@ class PeopleHandler : public SettingsPageUIHandler, ...@@ -126,10 +126,8 @@ class PeopleHandler : public SettingsPageUIHandler,
void FocusUI() override; void FocusUI() override;
// IdentityManager::Observer implementation. // IdentityManager::Observer implementation.
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 OnExtendedAccountInfoUpdated(const AccountInfo& info) override; void OnExtendedAccountInfoUpdated(const AccountInfo& info) override;
void OnExtendedAccountInfoRemoved(const AccountInfo& info) override; void OnExtendedAccountInfoRemoved(const AccountInfo& info) override;
......
...@@ -83,9 +83,14 @@ class SignInObserver : public signin::IdentityManager::Observer { ...@@ -83,9 +83,14 @@ class SignInObserver : public signin::IdentityManager::Observer {
FAIL() << "Sign in observer timed out!"; FAIL() << "Sign in observer timed out!";
} }
void OnPrimaryAccountSet( void OnPrimaryAccountChanged(
const CoreAccountInfo& primary_account_info) override { const signin::PrimaryAccountChangeEvent& event) override {
DVLOG(1) << "Google signin succeeded."; if (event.GetEventTypeFor(signin::ConsentLevel::kSync) !=
signin::PrimaryAccountChangeEvent::Type::kSet) {
return;
}
DVLOG(1) << "Sign in finished: Sync primary account was set.";
signed_in_ = true; signed_in_ = true;
QuitLoopRunner(); 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