Commit 275f98ad authored by chcunningham's avatar chcunningham Committed by Commit Bot

Delete SigninWrapper from ProfileSyncService init

The wrapper was used to provide references to SigninManager while the
transition to IdentityManager was ongoing. The ancestor of this CL*
will complete that transition, so we can delete this wrapper.

*https://chromium-review.googlesource.com/c/chromium/src/+/1175911

Bug: 809031
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I359d2beebdf76d6620ec46b5bc58748ebb61e544
Reviewed-on: https://chromium-review.googlesource.com/1175916
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587724}
parent 0064f414
......@@ -30,7 +30,6 @@
#include "chrome/browser/signin/chrome_device_id_helper.h"
#include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/unified_consent_helper.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/sync/bookmark_sync_service_factory.h"
......@@ -45,8 +44,6 @@
#include "components/browser_sync/profile_sync_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/network_time/network_time_tracker.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/driver/startup_controller.h"
#include "components/sync/driver/sync_util.h"
#include "content/public/browser/browser_context.h"
......@@ -149,7 +146,6 @@ ProfileSyncServiceFactory::ProfileSyncServiceFactory()
GetInstance());
DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance());
DependsOn(PasswordStoreFactory::GetInstance());
DependsOn(SigninManagerFactory::GetInstance());
DependsOn(SpellcheckServiceFactory::GetInstance());
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
DependsOn(SupervisedUserSettingsServiceFactory::GetInstance());
......@@ -234,9 +230,8 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor(
// once http://crbug.com/171406 has been fixed.
AboutSigninInternalsFactory::GetForProfile(profile);
init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(
IdentityManagerFactory::GetForProfile(profile),
SigninManagerFactory::GetForProfile(profile));
init_params.identity_manager =
IdentityManagerFactory::GetForProfile(profile);
init_params.signin_scoped_device_id_callback =
base::BindRepeating(&GetSigninScopedDeviceIdForProfile, profile);
init_params.gaia_cookie_manager_service =
......
......@@ -19,7 +19,6 @@
#include "components/browser_sync/profile_sync_service.h"
#include "components/browser_sync/profile_sync_test_util.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/driver/startup_controller.h"
#include "components/sync/driver/sync_api_component_factory_mock.h"
#include "content/public/browser/browser_context.h"
......@@ -47,9 +46,7 @@ ProfileSyncService::InitParams CreateProfileSyncServiceParamsForTest(
Profile* profile) {
ProfileSyncService::InitParams init_params;
init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(
IdentityManagerFactory::GetForProfile(profile),
SigninManagerFactory::GetForProfile(profile));
init_params.identity_manager = IdentityManagerFactory::GetForProfile(profile);
init_params.signin_scoped_device_id_callback =
base::BindRepeating([]() { return std::string(); });
init_params.start_behavior = ProfileSyncService::MANUAL_START;
......
......@@ -24,7 +24,6 @@
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/reading_list/features/reading_list_buildflags.h"
#include "components/signin/core/browser/account_info.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "components/sync/base/bind_to_task_runner.h"
#include "components/sync/base/cryptographer.h"
......@@ -39,7 +38,6 @@
#include "components/sync/driver/clear_server_data_events.h"
#include "components/sync/driver/configure_context.h"
#include "components/sync/driver/directory_data_type_controller.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/driver/sync_api_component_factory.h"
#include "components/sync/driver/sync_driver_switches.h"
#include "components/sync/driver/sync_error_controller.h"
......@@ -171,10 +169,10 @@ ProfileSyncService::InitParams::~InitParams() = default;
ProfileSyncService::ProfileSyncService(InitParams init_params)
: sync_client_(std::move(init_params.sync_client)),
sync_prefs_(sync_client_->GetPrefService()),
signin_(std::move(init_params.signin_wrapper)),
identity_manager_(init_params.identity_manager),
auth_manager_(std::make_unique<SyncAuthManager>(
&sync_prefs_,
signin_ ? signin_->GetIdentityManager() : nullptr,
identity_manager_,
base::BindRepeating(&ProfileSyncService::AccountStateChanged,
base::Unretained(this)),
base::BindRepeating(&ProfileSyncService::CredentialsChanged,
......@@ -1162,7 +1160,7 @@ void ProfileSyncService::OnActionableError(
// On every platform except ChromeOS, sign out the user after a dashboard
// clear.
if (!IsLocalSyncEnabled()) {
signin_->GetIdentityManager()->ClearPrimaryAccount(
identity_manager_->ClearPrimaryAccount(
identity::IdentityManager::ClearAccountTokensAction::kDefault,
signin_metrics::SERVER_FORCED_DISABLE,
signin_metrics::SignoutDelete::IGNORE_METRIC);
......
......@@ -46,12 +46,14 @@
#include "google_apis/gaia/google_service_auth_error.h"
#include "url/gurl.h"
class SigninManagerWrapper;
namespace base {
class MessageLoop;
}
namespace identity {
class IdentityManager;
}
namespace network {
class SharedURLLoaderFactory;
} // namespace network
......@@ -208,7 +210,7 @@ class ProfileSyncService : public syncer::SyncService,
~InitParams();
std::unique_ptr<syncer::SyncClient> sync_client;
std::unique_ptr<SigninManagerWrapper> signin_wrapper;
identity::IdentityManager* identity_manager;
SigninScopedDeviceIdCallback signin_scoped_device_id_callback;
GaiaCookieManagerService* gaia_cookie_manager_service = nullptr;
StartBehavior start_behavior = MANUAL_START;
......@@ -622,8 +624,8 @@ class ProfileSyncService : public syncer::SyncService,
syncer::SyncPrefs sync_prefs_;
// Encapsulates user signin - used to set/get the user's authenticated
// email address.
const std::unique_ptr<SigninManagerWrapper> signin_;
// email address and sign-out upon error.
identity::IdentityManager* const identity_manager_;
// Handles tracking of the authenticated account and acquiring access tokens.
// Only null after Shutdown().
......
......@@ -20,7 +20,6 @@
#include "components/sync/base/pref_names.h"
#include "components/sync/driver/configure_context.h"
#include "components/sync/driver/fake_data_type_controller.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/driver/sync_api_component_factory_mock.h"
#include "components/sync/driver/sync_driver_switches.h"
#include "components/sync/driver/sync_service_observer.h"
......@@ -223,7 +222,7 @@ class ProfileSyncServiceTest : public ::testing::Test {
prefs()->SetBoolean(syncer::prefs::kEnableLocalSyncBackend, true);
init_params.gaia_cookie_manager_service = nullptr;
init_params.signin_wrapper.reset();
init_params.identity_manager = nullptr;
service_ = std::make_unique<ProfileSyncService>(std::move(init_params));
......
......@@ -18,7 +18,6 @@
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "components/sync/base/sync_prefs.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/engine/passive_model_worker.h"
#include "components/sync/engine/sequenced_model_worker.h"
#include "components/sync/engine/ui_model_worker.h"
......@@ -284,8 +283,7 @@ ProfileSyncService::InitParams ProfileSyncServiceBundle::CreateBasicInitParams(
init_params.start_behavior = start_behavior;
init_params.sync_client = std::move(sync_client);
init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(
identity_manager(), signin_manager());
init_params.identity_manager = identity_manager();
init_params.signin_scoped_device_id_callback =
base::BindRepeating([]() { return std::string(); });
init_params.network_time_update_callback = base::DoNothing();
......
......@@ -134,8 +134,6 @@ jumbo_static_library("sync") {
"driver/shared_change_processor.h",
"driver/shared_change_processor_ref.cc",
"driver/shared_change_processor_ref.h",
"driver/signin_manager_wrapper.cc",
"driver/signin_manager_wrapper.h",
"driver/startup_controller.cc",
"driver/startup_controller.h",
"driver/sync_api_component_factory.cc",
......
// Copyright 2015 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/sync/driver/signin_manager_wrapper.h"
#include "services/identity/public/cpp/identity_manager.h"
SigninManagerWrapper::SigninManagerWrapper(
identity::IdentityManager* identity_manager,
SigninManagerBase* signin_manager)
: identity_manager_(identity_manager), signin_manager_(signin_manager) {}
SigninManagerWrapper::~SigninManagerWrapper() {}
identity::IdentityManager* SigninManagerWrapper::GetIdentityManager() {
return identity_manager_;
}
SigninManagerBase* SigninManagerWrapper::GetSigninManager() {
return signin_manager_;
}
// Copyright 2015 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_SYNC_DRIVER_SIGNIN_MANAGER_WRAPPER_H_
#define COMPONENTS_SYNC_DRIVER_SIGNIN_MANAGER_WRAPPER_H_
#include "base/macros.h"
class SigninManagerBase;
namespace identity {
class IdentityManager;
}
// TODO(crbug.com/825190): Get rid of this class after ProfileSyncService
// doesn't use SigninManager anymore.
class SigninManagerWrapper {
public:
explicit SigninManagerWrapper(identity::IdentityManager* identity_manager,
SigninManagerBase* signin_manager);
~SigninManagerWrapper();
// Return the original IdentityManager object that was passed in.
identity::IdentityManager* GetIdentityManager();
// Return the original SigninManagerBase object that was passed in.
SigninManagerBase* GetSigninManager();
private:
identity::IdentityManager* identity_manager_;
SigninManagerBase* signin_manager_;
DISALLOW_COPY_AND_ASSIGN(SigninManagerWrapper);
};
#endif // COMPONENTS_SYNC_DRIVER_SIGNIN_MANAGER_WRAPPER_H_
......@@ -12,11 +12,8 @@
#include "components/browser_sync/profile_sync_service_mock.h"
#include "components/browser_sync/profile_sync_test_util.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/signin/identity_manager_factory.h"
#include "ios/chrome/browser/signin/signin_manager_factory.h"
#include "ios/chrome/browser/sync/ios_chrome_sync_client.h"
#include "ios/chrome/common/channel_info.h"
#include "net/url_request/url_request_context_getter.h"
......@@ -28,9 +25,8 @@ CreateProfileSyncServiceParamsForTest(
ios::ChromeBrowserState* browser_state) {
browser_sync::ProfileSyncService::InitParams init_params;
init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(
IdentityManagerFactory::GetForBrowserState(browser_state),
ios::SigninManagerFactory::GetForBrowserState(browser_state));
init_params.identity_manager =
IdentityManagerFactory::GetForBrowserState(browser_state);
init_params.signin_scoped_device_id_callback =
base::BindRepeating([]() { return std::string(); });
init_params.start_behavior = browser_sync::ProfileSyncService::MANUAL_START;
......
......@@ -13,8 +13,6 @@
#include "components/network_time/network_time_tracker.h"
#include "components/signin/core/browser/device_id_helper.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/driver/startup_controller.h"
#include "components/sync/driver/sync_util.h"
#include "ios/chrome/browser/application_context.h"
......@@ -32,7 +30,6 @@
#include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h"
#include "ios/chrome/browser/signin/about_signin_internals_factory.h"
#include "ios/chrome/browser/signin/identity_manager_factory.h"
#include "ios/chrome/browser/signin/signin_manager_factory.h"
#include "ios/chrome/browser/sync/consent_auditor_factory.h"
#include "ios/chrome/browser/sync/ios_chrome_sync_client.h"
#include "ios/chrome/browser/sync/model_type_store_service_factory.h"
......@@ -106,7 +103,6 @@ ProfileSyncServiceFactory::ProfileSyncServiceFactory()
DependsOn(ios::BookmarkUndoServiceFactory::GetInstance());
DependsOn(ios::FaviconServiceFactory::GetInstance());
DependsOn(ios::HistoryServiceFactory::GetInstance());
DependsOn(ios::SigninManagerFactory::GetInstance());
DependsOn(ios::TemplateURLServiceFactory::GetInstance());
DependsOn(ios::WebDataServiceFactory::GetInstance());
DependsOn(IdentityManagerFactory::GetInstance());
......@@ -135,9 +131,8 @@ ProfileSyncServiceFactory::BuildServiceInstanceFor(
ios::AboutSigninInternalsFactory::GetForBrowserState(browser_state);
ProfileSyncService::InitParams init_params;
init_params.signin_wrapper = std::make_unique<SigninManagerWrapper>(
IdentityManagerFactory::GetForBrowserState(browser_state),
ios::SigninManagerFactory::GetForBrowserState(browser_state));
init_params.identity_manager =
IdentityManagerFactory::GetForBrowserState(browser_state);
init_params.signin_scoped_device_id_callback = base::BindRepeating(
&signin::GetSigninScopedDeviceId, browser_state->GetPrefs());
init_params.start_behavior = ProfileSyncService::MANUAL_START;
......
......@@ -12,9 +12,7 @@
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/signin/core/browser/device_id_helper.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync/base/model_type.h"
#include "components/sync/driver/signin_manager_wrapper.h"
#include "components/sync/driver/startup_controller.h"
#include "components/sync/driver/sync_util.h"
#include "ios/web/public/web_thread.h"
......@@ -23,7 +21,6 @@
#include "ios/web_view/internal/passwords/web_view_password_store_factory.h"
#include "ios/web_view/internal/signin/web_view_identity_manager_factory.h"
#include "ios/web_view/internal/signin/web_view_oauth2_token_service_factory.h"
#include "ios/web_view/internal/signin/web_view_signin_manager_factory.h"
#import "ios/web_view/internal/sync/web_view_gcm_profile_service_factory.h"
#import "ios/web_view/internal/sync/web_view_model_type_store_service_factory.h"
#import "ios/web_view/internal/sync/web_view_profile_invalidation_provider_factory.h"
......@@ -63,7 +60,6 @@ WebViewProfileSyncServiceFactory::WebViewProfileSyncServiceFactory()
// when it is shut down. Specify those dependencies here to build the proper
// destruction order.
DependsOn(WebViewIdentityManagerFactory::GetInstance());
DependsOn(WebViewSigninManagerFactory::GetInstance());
DependsOn(WebViewOAuth2TokenServiceFactory::GetInstance());
DependsOn(WebViewPersonalDataManagerFactory::GetInstance());
DependsOn(WebViewWebDataServiceWrapperFactory::GetInstance());
......@@ -83,13 +79,10 @@ WebViewProfileSyncServiceFactory::BuildServiceInstanceFor(
identity::IdentityManager* identity_manager =
WebViewIdentityManagerFactory::GetForBrowserState(browser_state);
SigninManagerBase* signin =
WebViewSigninManagerFactory::GetForBrowserState(browser_state);
WebViewGCMProfileServiceFactory::GetForBrowserState(browser_state);
ProfileSyncService::InitParams init_params;
init_params.signin_wrapper =
std::make_unique<SigninManagerWrapper>(identity_manager, signin);
init_params.identity_manager = identity_manager;
init_params.start_behavior = ProfileSyncService::MANUAL_START;
init_params.sync_client = std::make_unique<WebViewSyncClient>(browser_state);
init_params.url_loader_factory = browser_state->GetSharedURLLoaderFactory();
......
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