Commit e2b330a7 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Fix uses of ios::ChromeBrowserState in /ios/chrome/browser/signin

The ChromeBrowserState has been moved from the "ios" namespace
to the global namespace by http://crrev.com/c/2014913. Fix the
uses from ios::ChromeBrowserState to ChromeBrowserState.

Also remove includes of chrome_browser_state_forward.h and use
a simple forward declaration instead (since the old name is no
longer necessary).

This CL was uploaded by git cl split.

R=jlebel@chromium.org

Bug: 1042208
Change-Id: I5e8b4cd2b7991f40cde7e450a598a835813c3796
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2014975
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734624}
parent f5a15ce3
...@@ -30,7 +30,7 @@ AboutSigninInternalsFactory::~AboutSigninInternalsFactory() {} ...@@ -30,7 +30,7 @@ AboutSigninInternalsFactory::~AboutSigninInternalsFactory() {}
// static // static
AboutSigninInternals* AboutSigninInternalsFactory::GetForBrowserState( AboutSigninInternals* AboutSigninInternalsFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<AboutSigninInternals*>( return static_cast<AboutSigninInternals*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -44,8 +44,8 @@ AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() { ...@@ -44,8 +44,8 @@ AboutSigninInternalsFactory* AboutSigninInternalsFactory::GetInstance() {
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
AboutSigninInternalsFactory::BuildServiceInstanceFor( AboutSigninInternalsFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* chrome_browser_state = ChromeBrowserState* chrome_browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
std::unique_ptr<AboutSigninInternals> service(new AboutSigninInternals( std::unique_ptr<AboutSigninInternals> service(new AboutSigninInternals(
IdentityManagerFactory::GetForBrowserState(chrome_browser_state), IdentityManagerFactory::GetForBrowserState(chrome_browser_state),
SigninErrorControllerFactory::GetForBrowserState(chrome_browser_state), SigninErrorControllerFactory::GetForBrowserState(chrome_browser_state),
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class AboutSigninInternals; class AboutSigninInternals;
class ChromeBrowserState;
namespace ios { namespace ios {
// Singleton that owns all AboutSigninInternals and associates them with browser // Singleton that owns all AboutSigninInternals and associates them with browser
...@@ -22,7 +22,7 @@ class AboutSigninInternalsFactory : public BrowserStateKeyedServiceFactory { ...@@ -22,7 +22,7 @@ class AboutSigninInternalsFactory : public BrowserStateKeyedServiceFactory {
// Returns the instance of AboutSigninInternals associated with this browser // Returns the instance of AboutSigninInternals associated with this browser
// state, creating one if none exists. // state, creating one if none exists.
static AboutSigninInternals* GetForBrowserState( static AboutSigninInternals* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
// Returns an instance of the AboutSigninInternalsFactory singleton. // Returns an instance of the AboutSigninInternalsFactory singleton.
static AboutSigninInternalsFactory* GetInstance(); static AboutSigninInternalsFactory* GetInstance();
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class AccountConsistencyService; class AccountConsistencyService;
class ChromeBrowserState;
namespace ios { namespace ios {
// Singleton that creates the AccountConsistencyService(s) and associates those // Singleton that creates the AccountConsistencyService(s) and associates those
...@@ -25,7 +25,7 @@ class AccountConsistencyServiceFactory ...@@ -25,7 +25,7 @@ class AccountConsistencyServiceFactory
// state cannot have an AccountConsistencyService (for example, if it is // state cannot have an AccountConsistencyService (for example, if it is
// incognito or if WKWebView is not enabled). // incognito or if WKWebView is not enabled).
static AccountConsistencyService* GetForBrowserState( static AccountConsistencyService* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
// Returns an instance of the factory singleton. // Returns an instance of the factory singleton.
static AccountConsistencyServiceFactory* GetInstance(); static AccountConsistencyServiceFactory* GetInstance();
......
...@@ -33,7 +33,7 @@ AccountConsistencyServiceFactory::~AccountConsistencyServiceFactory() {} ...@@ -33,7 +33,7 @@ AccountConsistencyServiceFactory::~AccountConsistencyServiceFactory() {}
// static // static
AccountConsistencyService* AccountConsistencyServiceFactory::GetForBrowserState( AccountConsistencyService* AccountConsistencyServiceFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<AccountConsistencyService*>( return static_cast<AccountConsistencyService*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -53,8 +53,8 @@ void AccountConsistencyServiceFactory::RegisterBrowserStatePrefs( ...@@ -53,8 +53,8 @@ void AccountConsistencyServiceFactory::RegisterBrowserStatePrefs(
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
AccountConsistencyServiceFactory::BuildServiceInstanceFor( AccountConsistencyServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* chrome_browser_state = ChromeBrowserState* chrome_browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
return std::make_unique<AccountConsistencyService>( return std::make_unique<AccountConsistencyService>(
chrome_browser_state, chrome_browser_state->GetPrefs(), chrome_browser_state, chrome_browser_state->GetPrefs(),
ios::AccountReconcilorFactory::GetForBrowserState(chrome_browser_state), ios::AccountReconcilorFactory::GetForBrowserState(chrome_browser_state),
......
...@@ -31,7 +31,7 @@ AccountReconcilorFactory::~AccountReconcilorFactory() {} ...@@ -31,7 +31,7 @@ AccountReconcilorFactory::~AccountReconcilorFactory() {}
// static // static
AccountReconcilor* AccountReconcilorFactory::GetForBrowserState( AccountReconcilor* AccountReconcilorFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<AccountReconcilor*>( return static_cast<AccountReconcilor*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -44,8 +44,8 @@ AccountReconcilorFactory* AccountReconcilorFactory::GetInstance() { ...@@ -44,8 +44,8 @@ AccountReconcilorFactory* AccountReconcilorFactory::GetInstance() {
std::unique_ptr<KeyedService> AccountReconcilorFactory::BuildServiceInstanceFor( std::unique_ptr<KeyedService> AccountReconcilorFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* chrome_browser_state = ChromeBrowserState* chrome_browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
auto* identity_manager = auto* identity_manager =
IdentityManagerFactory::GetForBrowserState(chrome_browser_state); IdentityManagerFactory::GetForBrowserState(chrome_browser_state);
std::unique_ptr<AccountReconcilor> reconcilor(new AccountReconcilor( std::unique_ptr<AccountReconcilor> reconcilor(new AccountReconcilor(
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class AccountReconcilor; class AccountReconcilor;
class ChromeBrowserState;
namespace ios { namespace ios {
// Singleton that owns all AccountReconcilors and associates them with browser // Singleton that owns all AccountReconcilors and associates them with browser
...@@ -23,7 +23,7 @@ class AccountReconcilorFactory : public BrowserStateKeyedServiceFactory { ...@@ -23,7 +23,7 @@ class AccountReconcilorFactory : public BrowserStateKeyedServiceFactory {
// state (creating one if none exists). Returns null if this browser state // state (creating one if none exists). Returns null if this browser state
// cannot have an GaiaCookieManagerService (for example, if it is incognito). // cannot have an GaiaCookieManagerService (for example, if it is incognito).
static AccountReconcilor* GetForBrowserState( static AccountReconcilor* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
// Returns an instance of the factory singleton. // Returns an instance of the factory singleton.
static AccountReconcilorFactory* GetInstance(); static AccountReconcilorFactory* GetInstance();
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
namespace user_prefs { namespace user_prefs {
class PrefRegistrySyncable; class PrefRegistrySyncable;
...@@ -18,6 +17,7 @@ class PrefRegistrySyncable; ...@@ -18,6 +17,7 @@ class PrefRegistrySyncable;
class AuthenticationService; class AuthenticationService;
class AuthenticationServiceDelegate; class AuthenticationServiceDelegate;
class ChromeBrowserState;
// Singleton that owns all |AuthenticationServices| and associates them with // Singleton that owns all |AuthenticationServices| and associates them with
// browser states. Listens for the |BrowserState|'s destruction notification and // browser states. Listens for the |BrowserState|'s destruction notification and
...@@ -25,14 +25,14 @@ class AuthenticationServiceDelegate; ...@@ -25,14 +25,14 @@ class AuthenticationServiceDelegate;
class AuthenticationServiceFactory : public BrowserStateKeyedServiceFactory { class AuthenticationServiceFactory : public BrowserStateKeyedServiceFactory {
public: public:
static AuthenticationService* GetForBrowserState( static AuthenticationService* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static AuthenticationServiceFactory* GetInstance(); static AuthenticationServiceFactory* GetInstance();
// Force the instantiation of AuthenticationService and initialize it with // Force the instantiation of AuthenticationService and initialize it with
// the given delegate. Must be called before GetForBrowserState (not doing // the given delegate. Must be called before GetForBrowserState (not doing
// so is a security issue and the app will terminate). // so is a security issue and the app will terminate).
static void CreateAndInitializeForBrowserState( static void CreateAndInitializeForBrowserState(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
std::unique_ptr<AuthenticationServiceDelegate> delegate); std::unique_ptr<AuthenticationServiceDelegate> delegate);
// Returns the default factory used to build AuthenticationServices. Can be // Returns the default factory used to build AuthenticationServices. Can be
......
...@@ -24,8 +24,8 @@ namespace { ...@@ -24,8 +24,8 @@ namespace {
std::unique_ptr<KeyedService> BuildAuthenticationService( std::unique_ptr<KeyedService> BuildAuthenticationService(
web::BrowserState* context) { web::BrowserState* context) {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
return std::make_unique<AuthenticationService>( return std::make_unique<AuthenticationService>(
browser_state->GetPrefs(), browser_state->GetPrefs(),
SyncSetupServiceFactory::GetForBrowserState(browser_state), SyncSetupServiceFactory::GetForBrowserState(browser_state),
...@@ -37,7 +37,7 @@ std::unique_ptr<KeyedService> BuildAuthenticationService( ...@@ -37,7 +37,7 @@ std::unique_ptr<KeyedService> BuildAuthenticationService(
// static // static
AuthenticationService* AuthenticationServiceFactory::GetForBrowserState( AuthenticationService* AuthenticationServiceFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
AuthenticationService* service = static_cast<AuthenticationService*>( AuthenticationService* service = static_cast<AuthenticationService*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
CHECK(!service || service->initialized()); CHECK(!service || service->initialized());
...@@ -52,7 +52,7 @@ AuthenticationServiceFactory* AuthenticationServiceFactory::GetInstance() { ...@@ -52,7 +52,7 @@ AuthenticationServiceFactory* AuthenticationServiceFactory::GetInstance() {
// static // static
void AuthenticationServiceFactory::CreateAndInitializeForBrowserState( void AuthenticationServiceFactory::CreateAndInitializeForBrowserState(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
std::unique_ptr<AuthenticationServiceDelegate> delegate) { std::unique_ptr<AuthenticationServiceDelegate> delegate) {
AuthenticationService* service = static_cast<AuthenticationService*>( AuthenticationService* service = static_cast<AuthenticationService*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
......
...@@ -69,8 +69,8 @@ ChromeIdentity* AuthenticationServiceFake::GetAuthenticatedIdentity() const { ...@@ -69,8 +69,8 @@ ChromeIdentity* AuthenticationServiceFake::GetAuthenticatedIdentity() const {
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
AuthenticationServiceFake::CreateAuthenticationService( AuthenticationServiceFake::CreateAuthenticationService(
web::BrowserState* context) { web::BrowserState* context) {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
auto service = base::WrapUnique(new AuthenticationServiceFake( auto service = base::WrapUnique(new AuthenticationServiceFake(
browser_state->GetPrefs(), browser_state->GetPrefs(),
SyncSetupServiceFactory::GetForBrowserState(browser_state), SyncSetupServiceFactory::GetForBrowserState(browser_state),
......
...@@ -59,8 +59,8 @@ std::unique_ptr<KeyedService> BuildMockSyncService(web::BrowserState* context) { ...@@ -59,8 +59,8 @@ std::unique_ptr<KeyedService> BuildMockSyncService(web::BrowserState* context) {
std::unique_ptr<KeyedService> BuildMockSyncSetupService( std::unique_ptr<KeyedService> BuildMockSyncSetupService(
web::BrowserState* context) { web::BrowserState* context) {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
return std::make_unique<SyncSetupServiceMock>( return std::make_unique<SyncSetupServiceMock>(
ProfileSyncServiceFactory::GetForBrowserState(browser_state)); ProfileSyncServiceFactory::GetForBrowserState(browser_state));
} }
......
...@@ -150,7 +150,7 @@ class GaiaAuthFetcherIOSNSURLSessionBridgeTest : public ChromeWebTest { ...@@ -150,7 +150,7 @@ class GaiaAuthFetcherIOSNSURLSessionBridgeTest : public ChromeWebTest {
// be enabled. // be enabled.
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
// Browser state for the tests. // Browser state for the tests.
std::unique_ptr<ios::ChromeBrowserState> browser_state_; std::unique_ptr<ChromeBrowserState> browser_state_;
// Instance used for the tests. // Instance used for the tests.
std::unique_ptr<TestGaiaAuthFetcherIOSNSURLSessionBridge> std::unique_ptr<TestGaiaAuthFetcherIOSNSURLSessionBridge>
ns_url_session_bridge_; ns_url_session_bridge_;
......
...@@ -84,7 +84,7 @@ class GaiaAuthFetcherIOSTest : public PlatformTest { ...@@ -84,7 +84,7 @@ class GaiaAuthFetcherIOSTest : public PlatformTest {
return gaia_auth_fetcher_->bridge_.get(); return gaia_auth_fetcher_->bridge_.get();
} }
ios::ChromeBrowserState* browser_state() { return browser_state_.get(); } ChromeBrowserState* browser_state() { return browser_state_.get(); }
id GetMockWKWebView() { id GetMockWKWebView() {
GaiaAuthFetcherIOSWKWebViewBridge* wkWebviewBridge = GaiaAuthFetcherIOSWKWebViewBridge* wkWebviewBridge =
...@@ -95,7 +95,7 @@ class GaiaAuthFetcherIOSTest : public PlatformTest { ...@@ -95,7 +95,7 @@ class GaiaAuthFetcherIOSTest : public PlatformTest {
web::WebTaskEnvironment task_environment_; web::WebTaskEnvironment task_environment_;
// BrowserState, required for WKWebView creation. // BrowserState, required for WKWebView creation.
std::unique_ptr<ios::ChromeBrowserState> browser_state_; std::unique_ptr<ChromeBrowserState> browser_state_;
MockGaiaConsumer consumer_; MockGaiaConsumer consumer_;
network::TestURLLoaderFactory test_url_loader_factory_; network::TestURLLoaderFactory test_url_loader_factory_;
std::unique_ptr<GaiaAuthFetcherIOS> gaia_auth_fetcher_; std::unique_ptr<GaiaAuthFetcherIOS> gaia_auth_fetcher_;
......
...@@ -37,14 +37,14 @@ IdentityManagerFactory::~IdentityManagerFactory() {} ...@@ -37,14 +37,14 @@ IdentityManagerFactory::~IdentityManagerFactory() {}
// static // static
signin::IdentityManager* IdentityManagerFactory::GetForBrowserState( signin::IdentityManager* IdentityManagerFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<signin::IdentityManager*>( return static_cast<signin::IdentityManager*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
// static // static
signin::IdentityManager* IdentityManagerFactory::GetForBrowserStateIfExists( signin::IdentityManager* IdentityManagerFactory::GetForBrowserStateIfExists(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<signin::IdentityManager*>( return static_cast<signin::IdentityManager*>(
GetInstance()->GetServiceForBrowserState(browser_state, false)); GetInstance()->GetServiceForBrowserState(browser_state, false));
} }
...@@ -67,8 +67,8 @@ void IdentityManagerFactory::RemoveObserver( ...@@ -67,8 +67,8 @@ void IdentityManagerFactory::RemoveObserver(
std::unique_ptr<KeyedService> IdentityManagerFactory::BuildServiceInstanceFor( std::unique_ptr<KeyedService> IdentityManagerFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
signin::IdentityManagerBuildParams params; signin::IdentityManagerBuildParams params;
params.account_consistency = signin::AccountConsistencyMethod::kMirror; params.account_consistency = signin::AccountConsistencyMethod::kMirror;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class ChromeBrowserState;
class IdentityManagerFactoryObserver; class IdentityManagerFactoryObserver;
namespace signin { namespace signin {
...@@ -22,9 +22,9 @@ class IdentityManager; ...@@ -22,9 +22,9 @@ class IdentityManager;
class IdentityManagerFactory : public BrowserStateKeyedServiceFactory { class IdentityManagerFactory : public BrowserStateKeyedServiceFactory {
public: public:
static signin::IdentityManager* GetForBrowserState( static signin::IdentityManager* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static signin::IdentityManager* GetForBrowserStateIfExists( static signin::IdentityManager* GetForBrowserStateIfExists(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
// Returns an instance of the IdentityManagerFactory singleton. // Returns an instance of the IdentityManagerFactory singleton.
static IdentityManagerFactory* GetInstance(); static IdentityManagerFactory* GetInstance();
......
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/signin/ios/browser/wait_for_network_callback_helper.h" #include "components/signin/ios/browser/wait_for_network_callback_helper.h"
#include "components/signin/public/base/signin_client.h" #include "components/signin/public/base/signin_client.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
#include "net/cookies/cookie_change_dispatcher.h" #include "net/cookies/cookie_change_dispatcher.h"
class ChromeBrowserState;
// Concrete implementation of SigninClient for //ios/chrome. // Concrete implementation of SigninClient for //ios/chrome.
class IOSChromeSigninClient : public SigninClient { class IOSChromeSigninClient : public SigninClient {
public: public:
IOSChromeSigninClient( IOSChromeSigninClient(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
scoped_refptr<content_settings::CookieSettings> cookie_settings, scoped_refptr<content_settings::CookieSettings> cookie_settings,
scoped_refptr<HostContentSettingsMap> host_content_settings_map); scoped_refptr<HostContentSettingsMap> host_content_settings_map);
~IOSChromeSigninClient() override; ~IOSChromeSigninClient() override;
...@@ -49,7 +50,7 @@ class IOSChromeSigninClient : public SigninClient { ...@@ -49,7 +50,7 @@ class IOSChromeSigninClient : public SigninClient {
// Helper to delay callbacks until connection becomes online again. // Helper to delay callbacks until connection becomes online again.
std::unique_ptr<WaitForNetworkCallbackHelper> network_callback_helper_; std::unique_ptr<WaitForNetworkCallbackHelper> network_callback_helper_;
// The browser state associated with this service. // The browser state associated with this service.
ios::ChromeBrowserState* browser_state_; ChromeBrowserState* browser_state_;
// Used to check if sign in cookies are allowed. // Used to check if sign in cookies are allowed.
scoped_refptr<content_settings::CookieSettings> cookie_settings_; scoped_refptr<content_settings::CookieSettings> cookie_settings_;
// Used to add and remove content settings observers. // Used to add and remove content settings observers.
......
...@@ -23,15 +23,14 @@ ...@@ -23,15 +23,14 @@
#endif #endif
IOSChromeSigninClient::IOSChromeSigninClient( IOSChromeSigninClient::IOSChromeSigninClient(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
scoped_refptr<content_settings::CookieSettings> cookie_settings, scoped_refptr<content_settings::CookieSettings> cookie_settings,
scoped_refptr<HostContentSettingsMap> host_content_settings_map) scoped_refptr<HostContentSettingsMap> host_content_settings_map)
: network_callback_helper_( : network_callback_helper_(
std::make_unique<WaitForNetworkCallbackHelper>()), std::make_unique<WaitForNetworkCallbackHelper>()),
browser_state_(browser_state), browser_state_(browser_state),
cookie_settings_(cookie_settings), cookie_settings_(cookie_settings),
host_content_settings_map_(host_content_settings_map) { host_content_settings_map_(host_content_settings_map) {}
}
IOSChromeSigninClient::~IOSChromeSigninClient() { IOSChromeSigninClient::~IOSChromeSigninClient() {
} }
......
...@@ -29,13 +29,13 @@ void IOSChromeSigninStatusMetricsProviderDelegate::Initialize() { ...@@ -29,13 +29,13 @@ void IOSChromeSigninStatusMetricsProviderDelegate::Initialize() {
AccountsStatus AccountsStatus
IOSChromeSigninStatusMetricsProviderDelegate::GetStatusOfAllAccounts() { IOSChromeSigninStatusMetricsProviderDelegate::GetStatusOfAllAccounts() {
std::vector<ios::ChromeBrowserState*> browser_state_list = std::vector<ChromeBrowserState*> browser_state_list =
GetLoadedChromeBrowserStates(); GetLoadedChromeBrowserStates();
AccountsStatus accounts_status; AccountsStatus accounts_status;
accounts_status.num_accounts = browser_state_list.size(); accounts_status.num_accounts = browser_state_list.size();
accounts_status.num_opened_accounts = accounts_status.num_accounts; accounts_status.num_opened_accounts = accounts_status.num_accounts;
for (ios::ChromeBrowserState* browser_state : browser_state_list) { for (ChromeBrowserState* browser_state : browser_state_list) {
auto* manager = IdentityManagerFactory::GetForBrowserState( auto* manager = IdentityManagerFactory::GetForBrowserState(
browser_state->GetOriginalChromeBrowserState()); browser_state->GetOriginalChromeBrowserState());
if (manager && manager->HasPrimaryAccount()) if (manager && manager->HasPrimaryAccount())
...@@ -49,8 +49,7 @@ std::vector<signin::IdentityManager*> ...@@ -49,8 +49,7 @@ std::vector<signin::IdentityManager*>
IOSChromeSigninStatusMetricsProviderDelegate:: IOSChromeSigninStatusMetricsProviderDelegate::
GetIdentityManagersForAllAccounts() { GetIdentityManagersForAllAccounts() {
std::vector<signin::IdentityManager*> managers; std::vector<signin::IdentityManager*> managers;
for (ios::ChromeBrowserState* browser_state : for (ChromeBrowserState* browser_state : GetLoadedChromeBrowserStates()) {
GetLoadedChromeBrowserStates()) {
signin::IdentityManager* manager = signin::IdentityManager* manager =
IdentityManagerFactory::GetForBrowserStateIfExists(browser_state); IdentityManagerFactory::GetForBrowserStateIfExists(browser_state);
if (manager) { if (manager) {
...@@ -71,7 +70,7 @@ void IOSChromeSigninStatusMetricsProviderDelegate::IdentityManagerShutdown( ...@@ -71,7 +70,7 @@ void IOSChromeSigninStatusMetricsProviderDelegate::IdentityManagerShutdown(
owner()->OnIdentityManagerShutdown(manager); owner()->OnIdentityManagerShutdown(manager);
} }
std::vector<ios::ChromeBrowserState*> std::vector<ChromeBrowserState*>
IOSChromeSigninStatusMetricsProviderDelegate::GetLoadedChromeBrowserStates() { IOSChromeSigninStatusMetricsProviderDelegate::GetLoadedChromeBrowserStates() {
return GetApplicationContext() return GetApplicationContext()
->GetChromeBrowserStateManager() ->GetChromeBrowserStateManager()
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "components/signin/core/browser/signin_status_metrics_provider_delegate.h" #include "components/signin/core/browser/signin_status_metrics_provider_delegate.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
#include "ios/chrome/browser/signin/identity_manager_factory_observer.h" #include "ios/chrome/browser/signin/identity_manager_factory_observer.h"
class ChromeBrowserState;
class IOSChromeSigninStatusMetricsProviderDelegate class IOSChromeSigninStatusMetricsProviderDelegate
: public SigninStatusMetricsProviderDelegate, : public SigninStatusMetricsProviderDelegate,
public IdentityManagerFactoryObserver { public IdentityManagerFactoryObserver {
...@@ -31,7 +32,7 @@ class IOSChromeSigninStatusMetricsProviderDelegate ...@@ -31,7 +32,7 @@ class IOSChromeSigninStatusMetricsProviderDelegate
void IdentityManagerShutdown(signin::IdentityManager* manager) override; void IdentityManagerShutdown(signin::IdentityManager* manager) override;
// Returns the loaded ChromeBrowserState instances. // Returns the loaded ChromeBrowserState instances.
std::vector<ios::ChromeBrowserState*> GetLoadedChromeBrowserStates(); std::vector<ChromeBrowserState*> GetLoadedChromeBrowserStates();
DISALLOW_COPY_AND_ASSIGN(IOSChromeSigninStatusMetricsProviderDelegate); DISALLOW_COPY_AND_ASSIGN(IOSChromeSigninStatusMetricsProviderDelegate);
}; };
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class ChromeBrowserState;
class SigninBrowserStateInfoUpdater; class SigninBrowserStateInfoUpdater;
class SigninBrowserStateInfoUpdaterFactory class SigninBrowserStateInfoUpdaterFactory
...@@ -18,7 +18,7 @@ class SigninBrowserStateInfoUpdaterFactory ...@@ -18,7 +18,7 @@ class SigninBrowserStateInfoUpdaterFactory
// Returns nullptr if this browser state cannot have a // Returns nullptr if this browser state cannot have a
// SigninBrowserStateInfoUpdater (for example, if it is incognito). // SigninBrowserStateInfoUpdater (for example, if it is incognito).
static SigninBrowserStateInfoUpdater* GetForBrowserState( static SigninBrowserStateInfoUpdater* GetForBrowserState(
ios::ChromeBrowserState* chrome_browser_state); ChromeBrowserState* chrome_browser_state);
// Returns an instance of the factory singleton. // Returns an instance of the factory singleton.
static SigninBrowserStateInfoUpdaterFactory* GetInstance(); static SigninBrowserStateInfoUpdaterFactory* GetInstance();
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// static // static
SigninBrowserStateInfoUpdater* SigninBrowserStateInfoUpdater*
SigninBrowserStateInfoUpdaterFactory::GetForBrowserState( SigninBrowserStateInfoUpdaterFactory::GetForBrowserState(
ios::ChromeBrowserState* chrome_browser_state) { ChromeBrowserState* chrome_browser_state) {
return static_cast<SigninBrowserStateInfoUpdater*>( return static_cast<SigninBrowserStateInfoUpdater*>(
GetInstance()->GetServiceForBrowserState(chrome_browser_state, true)); GetInstance()->GetServiceForBrowserState(chrome_browser_state, true));
} }
...@@ -42,8 +42,8 @@ SigninBrowserStateInfoUpdaterFactory::~SigninBrowserStateInfoUpdaterFactory() {} ...@@ -42,8 +42,8 @@ SigninBrowserStateInfoUpdaterFactory::~SigninBrowserStateInfoUpdaterFactory() {}
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
SigninBrowserStateInfoUpdaterFactory::BuildServiceInstanceFor( SigninBrowserStateInfoUpdaterFactory::BuildServiceInstanceFor(
web::BrowserState* state) const { web::BrowserState* state) const {
ios::ChromeBrowserState* chrome_browser_state = ChromeBrowserState* chrome_browser_state =
ios::ChromeBrowserState::FromBrowserState(state); ChromeBrowserState::FromBrowserState(state);
return std::make_unique<SigninBrowserStateInfoUpdater>( return std::make_unique<SigninBrowserStateInfoUpdater>(
IdentityManagerFactory::GetForBrowserState(chrome_browser_state), IdentityManagerFactory::GetForBrowserState(chrome_browser_state),
ios::SigninErrorControllerFactory::GetForBrowserState( ios::SigninErrorControllerFactory::GetForBrowserState(
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// static // static
SigninClient* SigninClientFactory::GetForBrowserState( SigninClient* SigninClientFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<SigninClient*>( return static_cast<SigninClient*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -37,8 +37,8 @@ SigninClientFactory::~SigninClientFactory() {} ...@@ -37,8 +37,8 @@ SigninClientFactory::~SigninClientFactory() {}
std::unique_ptr<KeyedService> SigninClientFactory::BuildServiceInstanceFor( std::unique_ptr<KeyedService> SigninClientFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* chrome_browser_state = ChromeBrowserState* chrome_browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
return std::make_unique<IOSChromeSigninClient>( return std::make_unique<IOSChromeSigninClient>(
chrome_browser_state, chrome_browser_state,
ios::CookieSettingsFactory::GetForBrowserState(chrome_browser_state), ios::CookieSettingsFactory::GetForBrowserState(chrome_browser_state),
......
...@@ -10,16 +10,15 @@ ...@@ -10,16 +10,15 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class ChromeBrowserState;
class SigninClient; class SigninClient;
// Singleton that owns all SigninClients and associates them with // Singleton that owns all SigninClients and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class SigninClientFactory : public BrowserStateKeyedServiceFactory { class SigninClientFactory : public BrowserStateKeyedServiceFactory {
public: public:
static SigninClient* GetForBrowserState( static SigninClient* GetForBrowserState(ChromeBrowserState* browser_state);
ios::ChromeBrowserState* browser_state);
static SigninClientFactory* GetInstance(); static SigninClientFactory* GetInstance();
private: private:
......
...@@ -18,7 +18,7 @@ namespace ios { ...@@ -18,7 +18,7 @@ namespace ios {
// static // static
SigninErrorController* SigninErrorControllerFactory::GetForBrowserState( SigninErrorController* SigninErrorControllerFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<SigninErrorController*>( return static_cast<SigninErrorController*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
......
...@@ -10,17 +10,17 @@ ...@@ -10,17 +10,17 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class ChromeBrowserState;
class SigninErrorController; class SigninErrorController;
namespace ios { namespace ios {
// Singleton that owns all SigninErrorControllers and associates them with // Singleton that owns all SigninErrorControllers and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class SigninErrorControllerFactory : public BrowserStateKeyedServiceFactory { class SigninErrorControllerFactory : public BrowserStateKeyedServiceFactory {
public: public:
static SigninErrorController* GetForBrowserState( static SigninErrorController* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static SigninErrorControllerFactory* GetInstance(); static SigninErrorControllerFactory* GetInstance();
private: private:
......
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