Commit 376aa007 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

Introduce DeviceAccountsSynchronizer interface

This interface abstract the synchronisation of device accounts with
the IdentityManager. The goal is to promote the "legacy" methods
LegacyReloadAccountsFromSystem() and LegacyAddAccountFromSystem()
to supported method but with a nice abstraction that explain why
they are needed (i.e. access to accounts stored on some device
abstraction).

Add implementation (restricted to iOS for the moment, but could be
enabled on Android if needed) that just invoke the same code as the
old methods.

Convert iOS code to use the new interface and remove the old ones
(except LegacyAddAccountFromSystem which is now marked as Android
only).

See design at:
https://docs.google.com/document/d/1_NknywZB7UCQdCiCxEPQU85lXouid_aMxdzujEJSiEM/preview

Bug: 930094, 957887
Change-Id: I09fb20ea72c4cf584079e975276367c33392f416
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1690965
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676391}
parent dd0505ac
......@@ -32,4 +32,11 @@ source_set("identity_manager") {
"accounts_mutator_impl.h",
]
}
if (is_ios) {
sources += [
"device_accounts_synchronizer_impl.cc",
"device_accounts_synchronizer_impl.h",
]
}
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/internal/identity_manager/device_accounts_synchronizer_impl.h"
#include "base/logging.h"
#include "google_apis/gaia/oauth2_token_service_delegate.h"
namespace identity {
DeviceAccountsSynchronizerImpl::DeviceAccountsSynchronizerImpl(
OAuth2TokenServiceDelegate* token_service_delegate)
: token_service_delegate_(token_service_delegate) {
DCHECK(token_service_delegate_);
}
DeviceAccountsSynchronizerImpl::~DeviceAccountsSynchronizerImpl() = default;
void DeviceAccountsSynchronizerImpl::ReloadAllAccountsFromSystem() {
token_service_delegate_->ReloadAccountsFromSystem(
/*primary_account_id=*/CoreAccountId());
}
void DeviceAccountsSynchronizerImpl::ReloadAccountFromSystem(
const CoreAccountId& account_id) {
token_service_delegate_->AddAccountFromSystem(account_id);
}
} // namespace identity
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_DEVICE_ACCOUNTS_SYNCHRONIZER_IMPL_H_
#define COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_DEVICE_ACCOUNTS_SYNCHRONIZER_IMPL_H_
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
class OAuth2TokenServiceDelegate;
namespace identity {
// Concrete implementation of DeviceAccountsSynchronizer interface.
class DeviceAccountsSynchronizerImpl : public DeviceAccountsSynchronizer {
public:
explicit DeviceAccountsSynchronizerImpl(
OAuth2TokenServiceDelegate* token_service_delegate);
~DeviceAccountsSynchronizerImpl() override;
// DeviceAccountsSynchronizer implementation.
void ReloadAllAccountsFromSystem() override;
void ReloadAccountFromSystem(const CoreAccountId& account_id) override;
private:
OAuth2TokenServiceDelegate* token_service_delegate_ = nullptr;
};
} // namespace identity
#endif // COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_DEVICE_ACCOUNTS_SYNCHRONIZER_IMPL_H_
......@@ -14,6 +14,7 @@ source_set("identity_manager") {
"accounts_in_cookie_jar_info.cc",
"accounts_in_cookie_jar_info.h",
"accounts_mutator.h",
"device_accounts_synchronizer.h",
"diagnostics_provider.h",
"identity_manager.cc",
"identity_manager.h",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_DEVICE_ACCOUNTS_SYNCHRONIZER_H_
#define COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_DEVICE_ACCOUNTS_SYNCHRONIZER_H_
#include "google_apis/gaia/core_account_id.h"
namespace identity {
// DeviceAccountsSynchronizer is the interface to support seeding the accounts
// information from a device-level store.
class DeviceAccountsSynchronizer {
public:
DeviceAccountsSynchronizer() = default;
virtual ~DeviceAccountsSynchronizer() = default;
// Reloads the information of all device-level accounts. All device-level
// accounts will be visible in IdentityManager::GetAccountsWithRefreshTokens()
// with any persistent errors cleared after this method is called.
virtual void ReloadAllAccountsFromSystem() = 0;
// Reloads the information of the device-level account with |account_id|. The
// account will be visible in IdentityManager::GetAccountsWithRefreshTokens()
// with any persistent error cleared after this method is called.
virtual void ReloadAccountFromSystem(const CoreAccountId& account_id) = 0;
// Class is non-copyable, non-moveable.
DeviceAccountsSynchronizer(const DeviceAccountsSynchronizer&) = delete;
DeviceAccountsSynchronizer& operator=(const DeviceAccountsSynchronizer&) =
delete;
DeviceAccountsSynchronizer(DeviceAccountsSynchronizer&&) noexcept = delete;
DeviceAccountsSynchronizer& operator=(DeviceAccountsSynchronizer&&) noexcept =
delete;
};
} // namespace identity
#endif // COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_DEVICE_ACCOUNTS_SYNCHRONIZER_H_
......@@ -17,6 +17,7 @@
#include "components/signin/public/identity_manager/accounts_cookie_mutator.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#include "components/signin/public/identity_manager/diagnostics_provider.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
......@@ -53,7 +54,8 @@ IdentityManager::IdentityManager(
std::unique_ptr<PrimaryAccountMutator> primary_account_mutator,
std::unique_ptr<AccountsMutator> accounts_mutator,
std::unique_ptr<AccountsCookieMutator> accounts_cookie_mutator,
std::unique_ptr<DiagnosticsProvider> diagnostics_provider)
std::unique_ptr<DiagnosticsProvider> diagnostics_provider,
std::unique_ptr<DeviceAccountsSynchronizer> device_accounts_synchronizer)
: account_tracker_service_(std::move(account_tracker_service)),
token_service_(std::move(token_service)),
gaia_cookie_manager_service_(std::move(gaia_cookie_manager_service)),
......@@ -62,11 +64,15 @@ IdentityManager::IdentityManager(
primary_account_mutator_(std::move(primary_account_mutator)),
accounts_mutator_(std::move(accounts_mutator)),
accounts_cookie_mutator_(std::move(accounts_cookie_mutator)),
diagnostics_provider_(std::move(diagnostics_provider)) {
diagnostics_provider_(std::move(diagnostics_provider)),
device_accounts_synchronizer_(std::move(device_accounts_synchronizer)) {
DCHECK(account_fetcher_service_);
DCHECK(accounts_cookie_mutator_);
DCHECK(diagnostics_provider_);
DCHECK(!accounts_mutator_ || !device_accounts_synchronizer_)
<< "Cannot have both an AccountsMutator and a DeviceAccountsSynchronizer";
// IdentityManager will outlive the PrimaryAccountManager, so base::Unretained
// is safe.
primary_account_manager_->SetGoogleSigninSucceededCallback(
......@@ -354,6 +360,10 @@ AccountsCookieMutator* IdentityManager::GetAccountsCookieMutator() {
return accounts_cookie_mutator_.get();
}
DeviceAccountsSynchronizer* IdentityManager::GetDeviceAccountsSynchronizer() {
return device_accounts_synchronizer_.get();
}
void IdentityManager::AddDiagnosticsObserver(DiagnosticsObserver* observer) {
diagnostics_observer_list_.AddObserver(observer);
}
......@@ -415,21 +425,14 @@ DiagnosticsProvider* IdentityManager::GetDiagnosticsProvider() {
void IdentityManager::ForceTriggerOnCookieChange() {
gaia_cookie_manager_service_->ForceOnCookieChangeProcessing();
}
void IdentityManager::LegacyAddAccountFromSystem(
const CoreAccountId& account_id) {
token_service_->GetDelegate()->AddAccountFromSystem(account_id);
}
#endif
#if defined(OS_ANDROID) || defined(OS_IOS)
#if defined(OS_ANDROID)
void IdentityManager::LegacyReloadAccountsFromSystem() {
token_service_->GetDelegate()->ReloadAccountsFromSystem(
GetPrimaryAccountId());
}
#endif
#if defined(OS_ANDROID)
base::android::ScopedJavaLocalRef<jobject>
IdentityManager::LegacyGetAccountTrackerServiceJavaObject() {
return account_tracker_service_->GetJavaObject();
......
......@@ -50,6 +50,7 @@ class AccountsCookieMutator;
struct AccountsInCookieJarInfo;
class IdentityManagerTest;
class IdentityTestEnvironment;
class DeviceAccountsSynchronizer;
class DiagnosticsProvider;
class PrimaryAccountMutator;
enum class ClearPrimaryAccountPolicy;
......@@ -291,6 +292,10 @@ class IdentityManager : public KeyedService,
// accounts associated with them. Guaranteed to be non-null.
AccountsCookieMutator* GetAccountsCookieMutator();
// Returns pointer to the object used to seed accounts information from the
// device-level accounts. May be null if the system has no such notion.
DeviceAccountsSynchronizer* GetDeviceAccountsSynchronizer();
// Observer interface for classes that want to monitor status of various
// requests. Mostly useful in tests and debugging contexts (e.g., WebUI).
class DiagnosticsObserver {
......@@ -350,7 +355,8 @@ class IdentityManager : public KeyedService,
std::unique_ptr<PrimaryAccountMutator> primary_account_mutator,
std::unique_ptr<AccountsMutator> accounts_mutator,
std::unique_ptr<AccountsCookieMutator> accounts_cookie_mutator,
std::unique_ptr<DiagnosticsProvider> diagnostics_provider);
std::unique_ptr<DiagnosticsProvider> diagnostics_provider,
std::unique_ptr<DeviceAccountsSynchronizer> device_accounts_synchronizer);
~IdentityManager() override;
// Performs initialization that is dependent on the network being
......@@ -407,25 +413,16 @@ class IdentityManager : public KeyedService,
// TODO(https://crbug.com/930582) : Remove the need to expose this method
// or move it to the network::CookieManager.
void ForceTriggerOnCookieChange();
// Adds a given account to the token service from a system account. This
// API calls OAuth2TokenServiceDelegate::AddAccountFromSystem and it
// triggers platform specific implementation for IOS.
// NOTE: In normal usage, this method SHOULD NOT be called.
// TODO(https://crbug.com/930094): Eliminate the need to expose this.
void LegacyAddAccountFromSystem(const CoreAccountId& account_id);
#endif
#if defined(OS_ANDROID) || defined(OS_IOS)
#if defined(OS_ANDROID)
// Reloads the accounts in the token service from the system accounts. This
// API calls OAuth2TokenServiceDelegate::ReloadAccountsFromSystem and it
// triggers platform specific implementation for Android and IOS.
// triggers platform specific implementation for Android.
// NOTE: In normal usage, this method SHOULD NOT be called.
// TODO(https://crbug.com/930094): Eliminate the need to expose this.
void LegacyReloadAccountsFromSystem();
#endif
#if defined(OS_ANDROID)
// Returns a pointer to the AccountTrackerService Java instance associated
// with this object.
// TODO(https://crbug.com/934688): Eliminate this method once
......@@ -638,6 +635,9 @@ class IdentityManager : public KeyedService,
// DiagnosticsProvider instance.
std::unique_ptr<DiagnosticsProvider> diagnostics_provider_;
// DeviceAccountsSynchronizer instance.
std::unique_ptr<DeviceAccountsSynchronizer> device_accounts_synchronizer_;
// Lists of observers.
// Makes sure lists are empty on destruction.
base::ObserverList<Observer, true>::Unchecked observer_list_;
......
......@@ -18,13 +18,19 @@
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/public/base/signin_client.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#if !defined(OS_ANDROID)
#include "components/signin/core/browser/webdata/token_web_data.h"
#if !defined(OS_IOS)
#include "components/signin/internal/identity_manager/accounts_mutator_impl.h"
#endif
#if defined(OS_IOS)
#include "components/signin/internal/identity_manager/device_accounts_synchronizer_impl.h"
#endif
#if !defined(OS_ANDROID) && !defined(OS_IOS)
#include "components/signin/internal/identity_manager/accounts_mutator_impl.h"
#endif
#if !defined(OS_CHROMEOS)
......@@ -121,12 +127,20 @@ std::unique_ptr<IdentityManager> BuildIdentityManager(
account_tracker_service.get(),
std::move(params->image_decoder));
std::unique_ptr<DeviceAccountsSynchronizer> device_accounts_synchronizer;
#if defined(OS_IOS)
device_accounts_synchronizer =
std::make_unique<DeviceAccountsSynchronizerImpl>(
token_service->GetDelegate());
#endif
return std::make_unique<IdentityManager>(
std::move(account_tracker_service), std::move(token_service),
std::move(gaia_cookie_manager_service),
std::move(primary_account_manager), std::move(account_fetcher_service),
std::move(primary_account_mutator), std::move(accounts_mutator),
std::move(accounts_cookie_mutator), std::move(diagnostics_provider));
std::move(accounts_cookie_mutator), std::move(diagnostics_provider),
std::move(device_accounts_synchronizer));
}
} // namespace identity
......@@ -32,6 +32,7 @@
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/accounts_cookie_mutator.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
#include "components/signin/public/identity_manager/set_accounts_in_cookie_result.h"
......@@ -360,7 +361,7 @@ class IdentityManagerTest : public testing::Test {
std::move(gaia_cookie_manager_service),
std::move(primary_account_manager), std::move(account_fetcher_service),
nullptr, nullptr, std::move(accounts_cookie_mutator),
std::move(diagnostics_provider)));
std::move(diagnostics_provider), nullptr));
identity_manager_observer_.reset(
new TestIdentityManagerObserver(identity_manager_.get()));
identity_manager_diagnostics_observer_.reset(
......
......@@ -25,6 +25,7 @@
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/public/base/test_signin_client.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/identity_test_utils.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
......@@ -33,6 +34,7 @@
#include "google_apis/gaia/oauth2_access_token_consumer.h"
#if defined(OS_IOS)
#include "components/signin/internal/identity_manager/device_accounts_synchronizer_impl.h"
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
#endif
......@@ -235,12 +237,20 @@ IdentityTestEnvironment::BuildIdentityManagerForTests(
auto accounts_cookie_mutator = std::make_unique<AccountsCookieMutatorImpl>(
gaia_cookie_manager_service.get(), account_tracker_service.get());
std::unique_ptr<DeviceAccountsSynchronizer> device_accounts_synchronizer;
#if defined(OS_IOS)
device_accounts_synchronizer =
std::make_unique<DeviceAccountsSynchronizerImpl>(
token_service->GetDelegate());
#endif
return std::make_unique<IdentityManager>(
std::move(account_tracker_service), std::move(token_service),
std::move(gaia_cookie_manager_service),
std::move(primary_account_manager), std::move(account_fetcher_service),
std::move(primary_account_mutator), std::move(accounts_mutator),
std::move(accounts_cookie_mutator), std::move(diagnostics_provider));
std::move(accounts_cookie_mutator), std::move(diagnostics_provider),
std::move(device_accounts_synchronizer));
}
IdentityTestEnvironment::~IdentityTestEnvironment() {
......
......@@ -14,6 +14,7 @@
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#import "components/signin/public/identity_manager/primary_account_mutator.h"
#include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_user_settings.h"
......@@ -160,11 +161,17 @@ void AuthenticationService::OnApplicationWillEnterForeground() {
// Clear signin errors on the accounts that had a specific MDM device status.
// This will trigger services to fetch data for these accounts again.
std::map<std::string, NSDictionary*> cached_mdm_infos(cached_mdm_infos_);
cached_mdm_infos_.clear();
for (const auto& cached_mdm_info : cached_mdm_infos) {
// TODO(crbug.com/930094): Eliminate this.
identity_manager_->LegacyAddAccountFromSystem(cached_mdm_info.first);
using std::swap;
std::map<std::string, NSDictionary*> cached_mdm_infos;
swap(cached_mdm_infos_, cached_mdm_infos);
if (!cached_mdm_infos.empty()) {
identity::DeviceAccountsSynchronizer* device_accounts_synchronizer =
identity_manager_->GetDeviceAccountsSynchronizer();
for (const auto& cached_mdm_info : cached_mdm_infos) {
device_accounts_synchronizer->ReloadAccountFromSystem(
cached_mdm_info.first);
}
}
}
......@@ -301,7 +308,8 @@ void AuthenticationService::SignIn(ChromeIdentity* identity,
// Load all credentials from SSO library. This must load the credentials
// for the primary account too.
identity_manager_->LegacyReloadAccountsFromSystem();
identity_manager_->GetDeviceAccountsSynchronizer()
->ReloadAllAccountsFromSystem();
// Ensure that the account the user is trying to sign into has been loaded
// from the SSO library and that hosted_domain is set to the provided value.
......@@ -531,8 +539,8 @@ void AuthenticationService::ReloadCredentialsFromIdentities(
HandleForgottenIdentity(nil, should_prompt);
if (IsAuthenticated()) {
// TODO(crbug.com/930094): Eliminate this.
identity_manager_->LegacyReloadAccountsFromSystem();
identity_manager_->GetDeviceAccountsSynchronizer()
->ReloadAllAccountsFromSystem();
}
}
......
......@@ -11,6 +11,7 @@
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#import "components/signin/public/identity_manager/identity_test_environment.h"
#include "components/sync/driver/mock_sync_service.h"
......@@ -578,8 +579,9 @@ TEST_F(AuthenticationServiceTest, MigrateAccountsStoredInPref) {
// AccountTrackerService::Initialize(), it fails because account ids are
// updated with gaia ID from email at MigrateToGaiaId. As IdentityManager
// needs refresh token to find account info, it reloads all credentials.
// TODO(crbug.com/930094): Eliminate this.
identity_manager()->LegacyReloadAccountsFromSystem();
identity_manager()
->GetDeviceAccountsSynchronizer()
->ReloadAllAccountsFromSystem();
// Actually migrate the accounts in prefs.
MigrateAccountsStoredInPrefsIfNeeded();
......
......@@ -18,6 +18,7 @@
#include "components/signin/core/browser/primary_account_policy_manager_impl.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/internal/identity_manager/accounts_cookie_mutator_impl.h"
#include "components/signin/internal/identity_manager/device_accounts_synchronizer_impl.h"
#include "components/signin/internal/identity_manager/diagnostics_provider_impl.h"
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
......@@ -167,13 +168,17 @@ std::unique_ptr<KeyedService> IdentityManagerFactory::BuildServiceInstanceFor(
SigninClientFactory::GetForBrowserState(browser_state),
token_service.get(), account_tracker_service.get());
auto device_accounts_synchronizer =
std::make_unique<identity::DeviceAccountsSynchronizerImpl>(
token_service->GetDelegate());
auto identity_manager = std::make_unique<identity::IdentityManager>(
std::move(account_tracker_service), std::move(token_service),
std::move(gaia_cookie_manager_service),
std::move(primary_account_manager), std::move(account_fetcher_service),
std::move(primary_account_mutator),
/*accounts_mutator=*/nullptr, std::move(accounts_cookie_mutator),
std::move(diagnostics_provider));
std::move(diagnostics_provider), std::move(device_accounts_synchronizer));
for (auto& observer : observer_list_)
observer.IdentityManagerCreated(identity_manager.get());
......
......@@ -18,6 +18,7 @@
#include "components/signin/core/browser/primary_account_policy_manager_impl.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/internal/identity_manager/accounts_cookie_mutator_impl.h"
#include "components/signin/internal/identity_manager/device_accounts_synchronizer_impl.h"
#include "components/signin/internal/identity_manager/diagnostics_provider_impl.h"
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
......@@ -168,13 +169,17 @@ WebViewIdentityManagerFactory::BuildServiceInstanceFor(
WebViewSigninClientFactory::GetForBrowserState(browser_state),
token_service.get(), account_tracker_service.get());
auto device_accounts_synchronizer =
std::make_unique<identity::DeviceAccountsSynchronizerImpl>(
token_service->GetDelegate());
return std::make_unique<identity::IdentityManager>(
std::move(account_tracker_service), std::move(token_service),
std::move(gaia_cookie_manager_service),
std::move(primary_account_manager), std::move(account_fetcher_service),
std::move(primary_account_mutator),
/*accounts_mutator=*/nullptr, std::move(accounts_cookie_mutator),
std::move(diagnostics_provider));
std::move(diagnostics_provider), std::move(device_accounts_synchronizer));
}
} // namespace ios_web_view
......@@ -10,6 +10,7 @@
#include "base/strings/sys_string_conversions.h"
#include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/device_accounts_synchronizer.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/primary_account_mutator.h"
#include "components/sync/driver/sync_service.h"
......@@ -165,7 +166,8 @@ class WebViewSyncControllerObserverBridge
base::SysNSStringToUTF8(identity.gaiaID),
base::SysNSStringToUTF8(identity.email));
_identityManager->LegacyReloadAccountsFromSystem();
_identityManager->GetDeviceAccountsSynchronizer()
->ReloadAllAccountsFromSystem();
CHECK(_identityManager->HasAccountWithRefreshToken(accountId));
_identityManager->GetPrimaryAccountMutator()->SetPrimaryAccount(accountId);
......@@ -202,7 +204,8 @@ class WebViewSyncControllerObserverBridge
- (void)reloadCredentials {
if (_currentIdentity != nil) {
_identityManager->LegacyReloadAccountsFromSystem();
_identityManager->GetDeviceAccountsSynchronizer()
->ReloadAllAccountsFromSystem();
}
}
......
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