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

Convert c/b/extensions/api/identity/ to OnPrimaryAccountChanged

Methods OPrimaryAccountSet/Cleared() are deprecated, so this CL changes
the chrome/browser/extensions/api/identity/* to override the method
OnPrimaryAccountChanged().

Bug: 1163126
Change-Id: If5a4c51889816e2c7da2f5642f1ea610503f2775
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610101Reviewed-by: default avatarAlex Ilin <alexilin@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840538}
parent bd2bfdd4
......@@ -612,9 +612,11 @@ class IdentityTestWithSignin : public AsyncExtensionBrowserTest {
}
protected:
// Returns the account ID of the created account.
// Signs in (at sync consent level) and returns the account ID of the primary
// account.
CoreAccountId SignIn(const std::string& email) {
auto account_info = identity_test_env()->MakePrimaryAccountAvailable(email);
EXPECT_TRUE(identity_test_env()->identity_manager()->HasPrimaryAccount());
return account_info.account_id;
}
......
......@@ -691,13 +691,20 @@ bool IdentityGetAuthTokenFunction::TryRecoverFromServiceAuthError(
return false;
}
void IdentityGetAuthTokenFunction::OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) {
void IdentityGetAuthTokenFunction::OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event_details) {
if (event_details.GetEventTypeFor(signin::ConsentLevel::kSync) !=
signin::PrimaryAccountChangeEvent::Type::kSet)
return;
if (account_listening_mode_ != AccountListeningMode::kListeningPrimaryAccount)
return;
TRACE_EVENT_NESTABLE_ASYNC_INSTANT0("identity", "OnPrimaryAccountSet", this);
TRACE_EVENT_NESTABLE_ASYNC_INSTANT0("identity",
"OnPrimaryAccountChanged (set)", this);
const CoreAccountInfo& primary_account_info =
event_details.GetCurrentState().primary_account;
DCHECK(token_key_.account_info.IsEmpty());
token_key_.account_info = primary_account_info;
......
......@@ -165,8 +165,8 @@ class IdentityGetAuthTokenFunction : public ExtensionFunction,
void OnAccountsInCookieUpdated(
const signin::AccountsInCookieJarInfo& accounts_in_cookie_jar_info,
const GoogleServiceAuthError& error) override;
void OnPrimaryAccountSet(
const CoreAccountInfo& primary_account_info) override;
void OnPrimaryAccountChanged(
const signin::PrimaryAccountChangeEvent& event_details) override;
// Attempts to show the signin UI after the service auth error if this error
// isn't transient.
......
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