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