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