Commit 4f41b4c7 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Make ProfileSyncService::InitParams::invalidations_identity_providers a single item

Before this CL it was a vector, but after recent cleanups, it only ever
had a single entry.

Bug: 1029481
Change-Id: I0e7964d4233f08e102b1c0a0413aaff7dd6514ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2065004
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarMaksim Moskvitin <mmoskvitin@google.com>
Cr-Commit-Position: refs/heads/master@{#743098}
parent 995b52eb
......@@ -248,8 +248,8 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor(
invalidation::ProfileInvalidationProviderFactory::GetForProfile(
profile);
if (fcm_invalidation_provider) {
init_params.invalidations_identity_providers.push_back(
fcm_invalidation_provider->GetIdentityProvider());
init_params.invalidations_identity_provider =
fcm_invalidation_provider->GetIdentityProvider();
}
// TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync
......
......@@ -199,8 +199,8 @@ ProfileSyncService::ProfileSyncService(InitParams init_params)
sync_disabled_by_admin_(false),
unrecoverable_error_reason_(ERROR_REASON_UNSET),
expect_sync_configuration_aborted_(false),
invalidations_identity_providers_(
init_params.invalidations_identity_providers),
invalidations_identity_provider_(
init_params.invalidations_identity_provider),
create_http_post_provider_factory_cb_(
base::BindRepeating(&CreateHttpBridgeFactory)),
start_behavior_(init_params.start_behavior),
......@@ -267,10 +267,9 @@ void ProfileSyncService::Initialize() {
if (!IsLocalSyncEnabled()) {
auth_manager_->RegisterForAuthNotifications();
for (auto* provider : invalidations_identity_providers_) {
if (provider) {
provider->SetActiveAccountId(GetAuthenticatedAccountInfo().account_id);
}
if (invalidations_identity_provider_) {
invalidations_identity_provider_->SetActiveAccountId(
GetAuthenticatedAccountInfo().account_id);
}
}
......@@ -359,10 +358,9 @@ void ProfileSyncService::AccountStateChanged() {
}
// Propagate the (potentially) changed account ID to the invalidations system.
for (auto* provider : invalidations_identity_providers_) {
if (provider) {
provider->SetActiveAccountId(GetAuthenticatedAccountInfo().account_id);
}
if (invalidations_identity_provider_) {
invalidations_identity_provider_->SetActiveAccountId(
GetAuthenticatedAccountInfo().account_id);
}
}
......
......@@ -91,10 +91,7 @@ class ProfileSyncService : public SyncService,
// TODO(treib): Remove this and instead retrieve it via
// SyncClient::GetIdentityManager (but mind LocalSync).
signin::IdentityManager* identity_manager = nullptr;
// TODO(crbug.com/1029481): This vector only ever has one entry; replace by
// just a pointer.
std::vector<invalidation::IdentityProvider*>
invalidations_identity_providers;
invalidation::IdentityProvider* invalidations_identity_provider = nullptr;
StartBehavior start_behavior = MANUAL_START;
NetworkTimeUpdateCallback network_time_update_callback;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
......@@ -388,6 +385,7 @@ class ProfileSyncService : public SyncService,
// Encapsulates user signin - used to set/get the user's authenticated
// email address and sign-out upon error.
// May be null (if local Sync is enabled).
signin::IdentityManager* const identity_manager_;
// The user-configurable knobs. Non-null between Initialize() and Shutdown().
......@@ -489,11 +487,11 @@ class ProfileSyncService : public SyncService,
// or must delay loading for some reason).
DataTypeStatusTable::TypeErrorMap data_type_error_map_;
// This providers tells the invalidations code which identity to register for.
// This provider tells the invalidations code which identity to register for.
// The account that it registers for should be the same as the currently
// syncing account, so we'll need to update this whenever the account changes.
std::vector<invalidation::IdentityProvider*> const
invalidations_identity_providers_;
// May be null (if local Sync is enabled).
invalidation::IdentityProvider* const invalidations_identity_provider_;
// List of available data type controllers.
DataTypeController::TypeMap data_type_controllers_;
......
......@@ -51,8 +51,7 @@ ProfileSyncService::InitParams ProfileSyncServiceBundle::CreateBasicInitParams(
init_params.start_behavior = start_behavior;
init_params.sync_client = std::move(sync_client);
init_params.identity_manager = identity_manager();
init_params.invalidations_identity_providers.push_back(
identity_provider_.get());
init_params.invalidations_identity_provider = identity_provider_.get();
init_params.network_time_update_callback = base::DoNothing();
init_params.url_loader_factory =
base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
......
......@@ -178,8 +178,8 @@ ProfileSyncServiceFactory::BuildServiceInstanceFor(
IOSChromeProfileInvalidationProviderFactory::GetForBrowserState(
browser_state);
if (fcm_invalidation_provider) {
init_params.invalidations_identity_providers.push_back(
fcm_invalidation_provider->GetIdentityProvider());
init_params.invalidations_identity_provider =
fcm_invalidation_provider->GetIdentityProvider();
}
auto pss =
......
......@@ -94,10 +94,10 @@ WebViewProfileSyncServiceFactory::BuildServiceInstanceFor(
init_params.network_connection_tracker =
ApplicationContext::GetInstance()->GetNetworkConnectionTracker();
init_params.channel = version_info::Channel::STABLE;
init_params.invalidations_identity_providers.push_back(
init_params.invalidations_identity_provider =
WebViewProfileInvalidationProviderFactory::GetForBrowserState(
browser_state)
->GetIdentityProvider());
->GetIdentityProvider();
init_params.autofill_enable_account_wallet_storage =
base::FeatureList::IsEnabled(
autofill::features::kAutofillEnableAccountWalletStorage);
......
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