Commit e1fef60d authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Convert to use CoreAccountId on iOS.

This CL converts all ChromeOS code to use CoreAccountId instead of
std::string for the account id.

Bug: 959157
Change-Id: Ia27b9e566100ecd7c1ead3a5ca8e46da39e569ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1906149Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713856}
parent 6b045dc3
...@@ -207,7 +207,7 @@ void ProfileOAuth2TokenServiceIOSDelegate::ReloadCredentials() { ...@@ -207,7 +207,7 @@ void ProfileOAuth2TokenServiceIOSDelegate::ReloadCredentials() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
// Get the list of new account ids. // Get the list of new account ids.
std::set<std::string> new_account_ids; std::set<CoreAccountId> new_account_ids;
for (const auto& new_account : provider_->GetAllAccounts()) { for (const auto& new_account : provider_->GetAllAccounts()) {
DCHECK(!new_account.gaia.empty()); DCHECK(!new_account.gaia.empty());
DCHECK(!new_account.email.empty()); DCHECK(!new_account.email.empty());
...@@ -216,7 +216,7 @@ void ProfileOAuth2TokenServiceIOSDelegate::ReloadCredentials() { ...@@ -216,7 +216,7 @@ void ProfileOAuth2TokenServiceIOSDelegate::ReloadCredentials() {
// the GAIA ID is available if any client of this token service starts // the GAIA ID is available if any client of this token service starts
// a fetch access token operation when it receives a // a fetch access token operation when it receives a
// |OnRefreshTokenAvailable| notification. // |OnRefreshTokenAvailable| notification.
std::string account_id = account_tracker_service_->SeedAccountInfo( CoreAccountId account_id = account_tracker_service_->SeedAccountInfo(
AccountInfoFromDeviceAccount(new_account)); AccountInfoFromDeviceAccount(new_account));
new_account_ids.insert(account_id); new_account_ids.insert(account_id);
} }
......
...@@ -99,7 +99,7 @@ class ProfileOAuth2TokenServiceIOSDelegateTest ...@@ -99,7 +99,7 @@ class ProfileOAuth2TokenServiceIOSDelegateTest
auth_error_changed_count_ = 0; auth_error_changed_count_ = 0;
} }
std::string GetAccountId(const ProviderAccount& provider_account) { CoreAccountId GetAccountId(const ProviderAccount& provider_account) {
return account_tracker_.PickAccountIdForAccount(provider_account.gaia, return account_tracker_.PickAccountIdForAccount(provider_account.gaia,
provider_account.email); provider_account.email);
} }
...@@ -139,7 +139,8 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, ...@@ -139,7 +139,8 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest,
EXPECT_EQ(0, tokens_loaded_count_); EXPECT_EQ(0, tokens_loaded_count_);
EXPECT_EQ(1, token_revoked_count_); EXPECT_EQ(1, token_revoked_count_);
EXPECT_EQ(0U, oauth2_delegate_->GetAccounts().size()); EXPECT_EQ(0U, oauth2_delegate_->GetAccounts().size());
EXPECT_FALSE(oauth2_delegate_->RefreshTokenIsAvailable("another_account")); EXPECT_FALSE(oauth2_delegate_->RefreshTokenIsAvailable(
CoreAccountId("another_account")));
} }
TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest,
...@@ -277,7 +278,7 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, ...@@ -277,7 +278,7 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest,
ResetObserverCounts(); ResetObserverCounts();
GoogleServiceAuthError error(GoogleServiceAuthError::SERVICE_ERROR); GoogleServiceAuthError error(GoogleServiceAuthError::SERVICE_ERROR);
oauth2_delegate_->UpdateAuthError(GetAccountId(account1), error); oauth2_delegate_->UpdateAuthError(GetAccountId(account1), error);
EXPECT_EQ(error, oauth2_delegate_->GetAuthError("gaia_1")); EXPECT_EQ(error, oauth2_delegate_->GetAuthError(GetAccountId(account1)));
EXPECT_EQ(1, auth_error_changed_count_); EXPECT_EQ(1, auth_error_changed_count_);
oauth2_delegate_->RevokeAllCredentials(); oauth2_delegate_->RevokeAllCredentials();
...@@ -292,15 +293,15 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, GetAuthError) { ...@@ -292,15 +293,15 @@ TEST_F(ProfileOAuth2TokenServiceIOSDelegateTest, GetAuthError) {
oauth2_delegate_->ReloadCredentials(); oauth2_delegate_->ReloadCredentials();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(),
oauth2_delegate_->GetAuthError("gaia_1")); oauth2_delegate_->GetAuthError(GetAccountId(account1)));
// Update the error. // Update the error.
GoogleServiceAuthError error = GoogleServiceAuthError error =
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason( GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason:: GoogleServiceAuthError::InvalidGaiaCredentialsReason::
CREDENTIALS_REJECTED_BY_SERVER); CREDENTIALS_REJECTED_BY_SERVER);
oauth2_delegate_->UpdateAuthError("gaia_1", error); oauth2_delegate_->UpdateAuthError(GetAccountId(account1), error);
EXPECT_EQ(error, oauth2_delegate_->GetAuthError("gaia_1")); EXPECT_EQ(error, oauth2_delegate_->GetAuthError(GetAccountId(account1)));
// Unknown account has no error. // Unknown account has no error.
EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(),
oauth2_delegate_->GetAuthError("gaia_2")); oauth2_delegate_->GetAuthError(CoreAccountId("gaia_2")));
} }
...@@ -22,7 +22,7 @@ CoreAccountId::CoreAccountId(std::string&& id) : id(std::move(id)) {} ...@@ -22,7 +22,7 @@ CoreAccountId::CoreAccountId(std::string&& id) : id(std::move(id)) {}
CoreAccountId::CoreAccountId(const std::string& id) : id(id) {} CoreAccountId::CoreAccountId(const std::string& id) : id(id) {}
#if defined(OS_CHROMEOS) || defined(OS_IOS) || defined(OS_ANDROID) #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
CoreAccountId::operator std::string() const { CoreAccountId::operator std::string() const {
return id; return id;
} }
......
...@@ -24,7 +24,7 @@ struct CoreAccountId { ...@@ -24,7 +24,7 @@ struct CoreAccountId {
CoreAccountId& operator=(const CoreAccountId&); CoreAccountId& operator=(const CoreAccountId&);
CoreAccountId& operator=(CoreAccountId&&) noexcept; CoreAccountId& operator=(CoreAccountId&&) noexcept;
#if defined(OS_CHROMEOS) || defined(OS_IOS) || defined(OS_ANDROID) #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
// Those implicit constructor and conversion operator allow to // Those implicit constructor and conversion operator allow to
// progressively migrate the code to use this struct. Removing // progressively migrate the code to use this struct. Removing
// them is tracked by https://crbug.com/959161 // them is tracked by https://crbug.com/959161
......
...@@ -139,7 +139,7 @@ class AuthenticationService : public KeyedService, ...@@ -139,7 +139,7 @@ class AuthenticationService : public KeyedService,
// is only updated when the app is in foreground and used to detect // is only updated when the app is in foreground and used to detect
// if any change occurred while the app was in background. // if any change occurred while the app was in background.
// See HaveAccountsChangesWhileInBackground(). // See HaveAccountsChangesWhileInBackground().
std::vector<std::string> GetLastKnownAccountsFromForeground(); std::vector<CoreAccountId> GetLastKnownAccountsFromForeground();
// Returns the cached MDM infos associated with |identity|. If the cache // Returns the cached MDM infos associated with |identity|. If the cache
// is stale for |identity|, the entry might be removed. // is stale for |identity|, the entry might be removed.
...@@ -222,7 +222,7 @@ class AuthenticationService : public KeyedService, ...@@ -222,7 +222,7 @@ class AuthenticationService : public KeyedService,
bool is_reloading_credentials_ = false; bool is_reloading_credentials_ = false;
// Map between account IDs and their associated MDM error. // Map between account IDs and their associated MDM error.
mutable std::map<std::string, NSDictionary*> cached_mdm_infos_; mutable std::map<CoreAccountId, NSDictionary*> cached_mdm_infos_;
ScopedObserver<ios::ChromeIdentityService, ScopedObserver<ios::ChromeIdentityService,
ios::ChromeIdentityService::Observer> ios::ChromeIdentityService::Observer>
......
...@@ -54,7 +54,8 @@ enum LoginMethodAndSyncState { ...@@ -54,7 +54,8 @@ enum LoginMethodAndSyncState {
constexpr char kFakeAccountIdForRemovedAccount[] = "0000000000000"; constexpr char kFakeAccountIdForRemovedAccount[] = "0000000000000";
// Returns the account id associated with |identity|. // Returns the account id associated with |identity|.
std::string ChromeIdentityToAccountID(signin::IdentityManager* identity_manager, CoreAccountId ChromeIdentityToAccountID(
signin::IdentityManager* identity_manager,
ChromeIdentity* identity) { ChromeIdentity* identity) {
std::string gaia_id = base::SysNSStringToUTF8([identity gaiaID]); std::string gaia_id = base::SysNSStringToUTF8([identity gaiaID]);
auto maybe_account = auto maybe_account =
...@@ -152,7 +153,7 @@ void AuthenticationService::OnApplicationWillEnterForeground() { ...@@ -152,7 +153,7 @@ void AuthenticationService::OnApplicationWillEnterForeground() {
// Clear signin errors on the accounts that had a specific MDM device status. // Clear signin errors on the accounts that had a specific MDM device status.
// This will trigger services to fetch data for these accounts again. // This will trigger services to fetch data for these accounts again.
using std::swap; using std::swap;
std::map<std::string, NSDictionary*> cached_mdm_infos; std::map<CoreAccountId, NSDictionary*> cached_mdm_infos;
swap(cached_mdm_infos_, cached_mdm_infos); swap(cached_mdm_infos_, cached_mdm_infos);
if (!cached_mdm_infos.empty()) { if (!cached_mdm_infos.empty()) {
...@@ -201,7 +202,7 @@ void AuthenticationService::UpdateHaveAccountsChangedWhileInBackground() { ...@@ -201,7 +202,7 @@ void AuthenticationService::UpdateHaveAccountsChangedWhileInBackground() {
// Load accounts from preference before synchronizing the accounts with // Load accounts from preference before synchronizing the accounts with
// the system, otherwiser we would never detect any changes to the list // the system, otherwiser we would never detect any changes to the list
// of accounts. // of accounts.
std::vector<std::string> last_foreground_accounts = std::vector<CoreAccountId> last_foreground_accounts =
GetLastKnownAccountsFromForeground(); GetLastKnownAccountsFromForeground();
std::sort(last_foreground_accounts.begin(), last_foreground_accounts.end()); std::sort(last_foreground_accounts.begin(), last_foreground_accounts.end());
...@@ -214,7 +215,7 @@ void AuthenticationService::UpdateHaveAccountsChangedWhileInBackground() { ...@@ -214,7 +215,7 @@ void AuthenticationService::UpdateHaveAccountsChangedWhileInBackground() {
std::vector<CoreAccountInfo> current_accounts_info = std::vector<CoreAccountInfo> current_accounts_info =
identity_manager_->GetAccountsWithRefreshTokens(); identity_manager_->GetAccountsWithRefreshTokens();
std::vector<std::string> current_accounts; std::vector<CoreAccountId> current_accounts;
for (const CoreAccountInfo& account_info : current_accounts_info) for (const CoreAccountInfo& account_info : current_accounts_info)
current_accounts.push_back(account_info.account_id); current_accounts.push_back(account_info.account_id);
std::sort(current_accounts.begin(), current_accounts.end()); std::sort(current_accounts.begin(), current_accounts.end());
...@@ -239,11 +240,11 @@ void AuthenticationService::MigrateAccountsStoredInPrefsIfNeeded() { ...@@ -239,11 +240,11 @@ void AuthenticationService::MigrateAccountsStoredInPrefsIfNeeded() {
return; return;
} }
std::vector<std::string> account_ids = GetLastKnownAccountsFromForeground(); std::vector<CoreAccountId> account_ids = GetLastKnownAccountsFromForeground();
std::vector<base::Value> accounts_pref_value; std::vector<base::Value> accounts_pref_value;
for (const std::string& account_id : account_ids) { for (const auto& account_id : account_ids) {
if (identity_manager_->HasAccountWithRefreshToken(account_id)) { if (identity_manager_->HasAccountWithRefreshToken(account_id)) {
accounts_pref_value.emplace_back(account_id); accounts_pref_value.emplace_back(account_id.id);
} else { } else {
// The account for |email| was removed since the last application cold // The account for |email| was removed since the last application cold
// start. Insert |kFakeAccountIdForRemovedAccount| to ensure // start. Insert |kFakeAccountIdForRemovedAccount| to ensure
...@@ -268,16 +269,16 @@ void AuthenticationService::StoreKnownAccountsWhileInForeground() { ...@@ -268,16 +269,16 @@ void AuthenticationService::StoreKnownAccountsWhileInForeground() {
base::Value(std::move(accounts_pref_value))); base::Value(std::move(accounts_pref_value)));
} }
std::vector<std::string> std::vector<CoreAccountId>
AuthenticationService::GetLastKnownAccountsFromForeground() { AuthenticationService::GetLastKnownAccountsFromForeground() {
const base::Value* accounts_pref = const base::Value* accounts_pref =
pref_service_->GetList(prefs::kSigninLastAccounts); pref_service_->GetList(prefs::kSigninLastAccounts);
std::vector<std::string> accounts; std::vector<CoreAccountId> accounts;
for (const auto& value : accounts_pref->GetList()) { for (const auto& value : accounts_pref->GetList()) {
DCHECK(value.is_string()); DCHECK(value.is_string());
DCHECK(!value.GetString().empty()); DCHECK(!value.GetString().empty());
accounts.push_back(value.GetString()); accounts.push_back(CoreAccountId(value.GetString()));
} }
return accounts; return accounts;
} }
......
...@@ -65,6 +65,10 @@ std::unique_ptr<KeyedService> BuildMockSyncSetupService( ...@@ -65,6 +65,10 @@ std::unique_ptr<KeyedService> BuildMockSyncSetupService(
ProfileSyncServiceFactory::GetForBrowserState(browser_state)); ProfileSyncServiceFactory::GetForBrowserState(browser_state));
} }
CoreAccountId GetAccountId(ChromeIdentity* identity) {
return CoreAccountId(base::SysNSStringToUTF8([identity gaiaID]));
}
} // namespace } // namespace
class AuthenticationServiceTest : public PlatformTest { class AuthenticationServiceTest : public PlatformTest {
...@@ -112,7 +116,7 @@ class AuthenticationServiceTest : public PlatformTest { ...@@ -112,7 +116,7 @@ class AuthenticationServiceTest : public PlatformTest {
authentication_service()->StoreKnownAccountsWhileInForeground(); authentication_service()->StoreKnownAccountsWhileInForeground();
} }
std::vector<std::string> GetLastKnownAccountsFromForeground() { std::vector<CoreAccountId> GetLastKnownAccountsFromForeground() {
return authentication_service()->GetLastKnownAccountsFromForeground(); return authentication_service()->GetLastKnownAccountsFromForeground();
} }
...@@ -134,14 +138,13 @@ class AuthenticationServiceTest : public PlatformTest { ...@@ -134,14 +138,13 @@ class AuthenticationServiceTest : public PlatformTest {
} }
void SetCachedMDMInfo(ChromeIdentity* identity, NSDictionary* user_info) { void SetCachedMDMInfo(ChromeIdentity* identity, NSDictionary* user_info) {
authentication_service() authentication_service()->cached_mdm_infos_[GetAccountId(identity)] =
->cached_mdm_infos_[base::SysNSStringToUTF8([identity gaiaID])] =
user_info; user_info;
} }
bool HasCachedMDMInfo(ChromeIdentity* identity) { bool HasCachedMDMInfo(ChromeIdentity* identity) {
return authentication_service()->cached_mdm_infos_.count( return authentication_service()->cached_mdm_infos_.count(
base::SysNSStringToUTF8([identity gaiaID])) > 0; GetAccountId(identity)) > 0;
} }
AuthenticationService* authentication_service() { AuthenticationService* authentication_service() {
...@@ -249,7 +252,7 @@ TEST_F(AuthenticationServiceTest, TestHandleForgottenIdentityPromptSignIn) { ...@@ -249,7 +252,7 @@ TEST_F(AuthenticationServiceTest, TestHandleForgottenIdentityPromptSignIn) {
TEST_F(AuthenticationServiceTest, StoreAndGetAccountsInPrefs) { TEST_F(AuthenticationServiceTest, StoreAndGetAccountsInPrefs) {
// Profile starts empty. // Profile starts empty.
std::vector<std::string> accounts = GetLastKnownAccountsFromForeground(); std::vector<CoreAccountId> accounts = GetLastKnownAccountsFromForeground();
EXPECT_TRUE(accounts.empty()); EXPECT_TRUE(accounts.empty());
// Sign in. // Sign in.
...@@ -261,8 +264,8 @@ TEST_F(AuthenticationServiceTest, StoreAndGetAccountsInPrefs) { ...@@ -261,8 +264,8 @@ TEST_F(AuthenticationServiceTest, StoreAndGetAccountsInPrefs) {
StoreKnownAccountsWhileInForeground(); StoreKnownAccountsWhileInForeground();
accounts = GetLastKnownAccountsFromForeground(); accounts = GetLastKnownAccountsFromForeground();
ASSERT_EQ(2u, accounts.size()); ASSERT_EQ(2u, accounts.size());
EXPECT_EQ("foo2ID", accounts[0]); EXPECT_EQ(CoreAccountId("foo2ID"), accounts[0]);
EXPECT_EQ("fooID", accounts[1]); EXPECT_EQ(CoreAccountId("fooID"), accounts[1]);
} }
TEST_F(AuthenticationServiceTest, TEST_F(AuthenticationServiceTest,
...@@ -281,8 +284,8 @@ TEST_F(AuthenticationServiceTest, ...@@ -281,8 +284,8 @@ TEST_F(AuthenticationServiceTest,
identity_manager()->GetAccountsWithRefreshTokens(); identity_manager()->GetAccountsWithRefreshTokens();
std::sort(accounts.begin(), accounts.end(), account_compare_func); std::sort(accounts.begin(), accounts.end(), account_compare_func);
ASSERT_EQ(2u, accounts.size()); ASSERT_EQ(2u, accounts.size());
EXPECT_EQ("foo2ID", accounts[0].account_id); EXPECT_EQ(CoreAccountId("foo2ID"), accounts[0].account_id);
EXPECT_EQ("fooID", accounts[1].account_id); EXPECT_EQ(CoreAccountId("fooID"), accounts[1].account_id);
// Simulate a switching to background and back to foreground, triggering a // Simulate a switching to background and back to foreground, triggering a
// credentials reload. // credentials reload.
...@@ -294,9 +297,9 @@ TEST_F(AuthenticationServiceTest, ...@@ -294,9 +297,9 @@ TEST_F(AuthenticationServiceTest,
accounts = identity_manager()->GetAccountsWithRefreshTokens(); accounts = identity_manager()->GetAccountsWithRefreshTokens();
std::sort(accounts.begin(), accounts.end(), account_compare_func); std::sort(accounts.begin(), accounts.end(), account_compare_func);
ASSERT_EQ(3u, accounts.size()); ASSERT_EQ(3u, accounts.size());
EXPECT_EQ("foo2ID", accounts[0].account_id); EXPECT_EQ(CoreAccountId("foo2ID"), accounts[0].account_id);
EXPECT_EQ("foo3ID", accounts[1].account_id); EXPECT_EQ(CoreAccountId("foo3ID"), accounts[1].account_id);
EXPECT_EQ("fooID", accounts[2].account_id); EXPECT_EQ(CoreAccountId("fooID"), accounts[2].account_id);
} }
TEST_F(AuthenticationServiceTest, HaveAccountsChanged_Default) { TEST_F(AuthenticationServiceTest, HaveAccountsChanged_Default) {
...@@ -429,7 +432,7 @@ TEST_F(AuthenticationServiceTest, MDMErrorsClearedOnForeground) { ...@@ -429,7 +432,7 @@ TEST_F(AuthenticationServiceTest, MDMErrorsClearedOnForeground) {
GoogleServiceAuthError error( GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
signin::UpdatePersistentErrorOfRefreshTokenForAccount( signin::UpdatePersistentErrorOfRefreshTokenForAccount(
identity_manager(), base::SysNSStringToUTF8([identity(0) gaiaID]), error); identity_manager(), GetAccountId(identity(0)), error);
// MDM error for |identity_| is being cleared and the error state of refresh // MDM error for |identity_| is being cleared and the error state of refresh
// token will be updated. // token will be updated.
...@@ -482,7 +485,7 @@ TEST_F(AuthenticationServiceTest, HandleMDMNotification) { ...@@ -482,7 +485,7 @@ TEST_F(AuthenticationServiceTest, HandleMDMNotification) {
GoogleServiceAuthError error( GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
signin::UpdatePersistentErrorOfRefreshTokenForAccount( signin::UpdatePersistentErrorOfRefreshTokenForAccount(
identity_manager(), base::SysNSStringToUTF8([identity(0) gaiaID]), error); identity_manager(), GetAccountId(identity(0)), error);
NSDictionary* user_info1 = @{ @"foo" : @1 }; NSDictionary* user_info1 = @{ @"foo" : @1 };
ON_CALL(*identity_service(), GetMDMDeviceStatus(user_info1)) ON_CALL(*identity_service(), GetMDMDeviceStatus(user_info1))
...@@ -518,7 +521,7 @@ TEST_F(AuthenticationServiceTest, HandleMDMBlockedNotification) { ...@@ -518,7 +521,7 @@ TEST_F(AuthenticationServiceTest, HandleMDMBlockedNotification) {
GoogleServiceAuthError error( GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
signin::UpdatePersistentErrorOfRefreshTokenForAccount( signin::UpdatePersistentErrorOfRefreshTokenForAccount(
identity_manager(), base::SysNSStringToUTF8([identity(0) gaiaID]), error); identity_manager(), GetAccountId(identity(0)), error);
NSDictionary* user_info1 = @{ @"foo" : @1 }; NSDictionary* user_info1 = @{ @"foo" : @1 };
ON_CALL(*identity_service(), GetMDMDeviceStatus(user_info1)) ON_CALL(*identity_service(), GetMDMDeviceStatus(user_info1))
...@@ -576,7 +579,7 @@ TEST_F(AuthenticationServiceTest, ShowMDMErrorDialog) { ...@@ -576,7 +579,7 @@ TEST_F(AuthenticationServiceTest, ShowMDMErrorDialog) {
GoogleServiceAuthError error( GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
signin::UpdatePersistentErrorOfRefreshTokenForAccount( signin::UpdatePersistentErrorOfRefreshTokenForAccount(
identity_manager(), base::SysNSStringToUTF8([identity(0) gaiaID]), error); identity_manager(), GetAccountId(identity(0)), error);
NSDictionary* user_info = [NSDictionary dictionary]; NSDictionary* user_info = [NSDictionary dictionary];
SetCachedMDMInfo(identity(0), user_info); SetCachedMDMInfo(identity(0), user_info);
......
...@@ -336,9 +336,9 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10; ...@@ -336,9 +336,9 @@ const int64_t kAuthenticationFlowTimeoutSeconds = 10;
- (BOOL)shouldHandleMergeCaseForIdentity:(ChromeIdentity*)identity - (BOOL)shouldHandleMergeCaseForIdentity:(ChromeIdentity*)identity
browserState: browserState:
(ios::ChromeBrowserState*)browserState { (ios::ChromeBrowserState*)browserState {
std::string lastSignedInAccountId = CoreAccountId lastSignedInAccountId(
browserState->GetPrefs()->GetString(prefs::kGoogleServicesLastAccountId); browserState->GetPrefs()->GetString(prefs::kGoogleServicesLastAccountId));
std::string currentSignedInAccountId = CoreAccountId currentSignedInAccountId =
IdentityManagerFactory::GetForBrowserState(browserState) IdentityManagerFactory::GetForBrowserState(browserState)
->PickAccountIdForAccount( ->PickAccountIdForAccount(
base::SysNSStringToUTF8([identity gaiaID]), base::SysNSStringToUTF8([identity gaiaID]),
......
...@@ -259,7 +259,7 @@ enum AuthenticationState { ...@@ -259,7 +259,7 @@ enum AuthenticationState {
int consent_confirmation_id = showAccountsSettings int consent_confirmation_id = showAccountsSettings
? openSettingsStringId ? openSettingsStringId
: [self acceptSigninButtonStringId]; : [self acceptSigninButtonStringId];
std::string account_id = CoreAccountId account_id =
IdentityManagerFactory::GetForBrowserState(self.browserState) IdentityManagerFactory::GetForBrowserState(self.browserState)
->PickAccountIdForAccount( ->PickAccountIdForAccount(
base::SysNSStringToUTF8([_selectedIdentity gaiaID]), base::SysNSStringToUTF8([_selectedIdentity gaiaID]),
......
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