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

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

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=olivierrobin@chromium.org

Bug: 1042208
Change-Id: I1ddc44348261707de426dc3b4168196145a52f87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017463
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735929}
parent 23407e6c
...@@ -24,7 +24,7 @@ namespace autofill { ...@@ -24,7 +24,7 @@ namespace autofill {
// static // static
AutocompleteHistoryManager* AutocompleteHistoryManager*
AutocompleteHistoryManagerFactory::GetForBrowserState( AutocompleteHistoryManagerFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<AutocompleteHistoryManager*>( return static_cast<AutocompleteHistoryManager*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -48,8 +48,8 @@ AutocompleteHistoryManagerFactory::~AutocompleteHistoryManagerFactory() {} ...@@ -48,8 +48,8 @@ AutocompleteHistoryManagerFactory::~AutocompleteHistoryManagerFactory() {}
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
AutocompleteHistoryManagerFactory::BuildServiceInstanceFor( AutocompleteHistoryManagerFactory::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<AutocompleteHistoryManager> service( std::unique_ptr<AutocompleteHistoryManager> service(
new AutocompleteHistoryManager()); new AutocompleteHistoryManager());
auto autofill_db = auto autofill_db =
......
...@@ -10,19 +10,20 @@ ...@@ -10,19 +10,20 @@
#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;
namespace autofill { namespace autofill {
class AutocompleteHistoryManager; class AutocompleteHistoryManager;
// Singleton that owns all AutocompleteHistoryManagers and associates them with // Singleton that owns all AutocompleteHistoryManagers and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class AutocompleteHistoryManagerFactory class AutocompleteHistoryManagerFactory
: public BrowserStateKeyedServiceFactory { : public BrowserStateKeyedServiceFactory {
public: public:
static AutocompleteHistoryManager* GetForBrowserState( static AutocompleteHistoryManager* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static AutocompleteHistoryManagerFactory* GetInstance(); static AutocompleteHistoryManagerFactory* GetInstance();
private: private:
......
...@@ -378,7 +378,7 @@ TEST_F(AutofillControllerTest, ReadFormName) { ...@@ -378,7 +378,7 @@ TEST_F(AutofillControllerTest, ReadFormName) {
TEST_F(AutofillControllerTest, ProfileImport) { TEST_F(AutofillControllerTest, ProfileImport) {
PersonalDataManager* personal_data_manager = PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForBrowserState( PersonalDataManagerFactory::GetForBrowserState(
ios::ChromeBrowserState::FromBrowserState(GetBrowserState())); ChromeBrowserState::FromBrowserState(GetBrowserState()));
// Check there are no registered profiles already. // Check there are no registered profiles already.
EXPECT_EQ(0U, personal_data_manager->GetProfiles().size()); EXPECT_EQ(0U, personal_data_manager->GetProfiles().size());
ASSERT_TRUE(LoadHtmlAndWaitForFormFetched(kProfileFormHtml, 1)); ASSERT_TRUE(LoadHtmlAndWaitForFormFetched(kProfileFormHtml, 1));
...@@ -413,7 +413,7 @@ void AutofillControllerTest::SetUpForSuggestions( ...@@ -413,7 +413,7 @@ void AutofillControllerTest::SetUpForSuggestions(
size_t expected_number_of_forms) { size_t expected_number_of_forms) {
PersonalDataManager* personal_data_manager = PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForBrowserState( PersonalDataManagerFactory::GetForBrowserState(
ios::ChromeBrowserState::FromBrowserState(GetBrowserState())); ChromeBrowserState::FromBrowserState(GetBrowserState()));
AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/");
profile.SetRawInfo(NAME_FULL, base::UTF8ToUTF16("Homer Simpson")); profile.SetRawInfo(NAME_FULL, base::UTF8ToUTF16("Homer Simpson"));
profile.SetRawInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("123 Main Street")); profile.SetRawInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("123 Main Street"));
...@@ -478,7 +478,7 @@ TEST_F(AutofillControllerTest, ProfileSuggestionsFromSelectField) { ...@@ -478,7 +478,7 @@ TEST_F(AutofillControllerTest, ProfileSuggestionsFromSelectField) {
TEST_F(AutofillControllerTest, MultipleProfileSuggestions) { TEST_F(AutofillControllerTest, MultipleProfileSuggestions) {
PersonalDataManager* personal_data_manager = PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForBrowserState( PersonalDataManagerFactory::GetForBrowserState(
ios::ChromeBrowserState::FromBrowserState(GetBrowserState())); ChromeBrowserState::FromBrowserState(GetBrowserState()));
PersonalDataManagerFinishedProfileTasksWaiter waiter(personal_data_manager); PersonalDataManagerFinishedProfileTasksWaiter waiter(personal_data_manager);
AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/");
...@@ -644,7 +644,7 @@ TEST_F(AutofillControllerTest, CreditCardImport) { ...@@ -644,7 +644,7 @@ TEST_F(AutofillControllerTest, CreditCardImport) {
InfoBarManagerImpl::CreateForWebState(web_state()); InfoBarManagerImpl::CreateForWebState(web_state());
PersonalDataManager* personal_data_manager = PersonalDataManager* personal_data_manager =
PersonalDataManagerFactory::GetForBrowserState( PersonalDataManagerFactory::GetForBrowserState(
ios::ChromeBrowserState::FromBrowserState(GetBrowserState())); ChromeBrowserState::FromBrowserState(GetBrowserState()));
// Check there are no registered profiles already. // Check there are no registered profiles already.
EXPECT_EQ(0U, personal_data_manager->GetCreditCards().size()); EXPECT_EQ(0U, personal_data_manager->GetCreditCards().size());
......
...@@ -17,7 +17,7 @@ namespace autofill { ...@@ -17,7 +17,7 @@ namespace autofill {
// static // static
LogRouter* AutofillLogRouterFactory::GetForBrowserState( LogRouter* AutofillLogRouterFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<LogRouter*>( return static_cast<LogRouter*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +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;
namespace autofill { namespace autofill {
...@@ -19,7 +20,7 @@ class LogRouter; ...@@ -19,7 +20,7 @@ class LogRouter;
class AutofillLogRouterFactory : public BrowserStateKeyedServiceFactory { class AutofillLogRouterFactory : public BrowserStateKeyedServiceFactory {
public: public:
static autofill::LogRouter* GetForBrowserState( static autofill::LogRouter* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static AutofillLogRouterFactory* GetInstance(); static AutofillLogRouterFactory* GetInstance();
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
#include "ios/web/public/web_state_observer.h" #include "ios/web/public/web_state_observer.h"
#import "ios/web/public/web_state_user_data.h" #import "ios/web/public/web_state_user_data.h"
@class AutofillAgent; @class AutofillAgent;
class ChromeBrowserState;
@protocol FormSuggestionProvider; @protocol FormSuggestionProvider;
@class UIViewController; @class UIViewController;
...@@ -51,7 +51,7 @@ class AutofillTabHelper : public web::WebStateObserver, ...@@ -51,7 +51,7 @@ class AutofillTabHelper : public web::WebStateObserver,
void WebStateDestroyed(web::WebState* web_state) override; void WebStateDestroyed(web::WebState* web_state) override;
// The BrowserState associated with this WebState. // The BrowserState associated with this WebState.
ios::ChromeBrowserState* browser_state_; ChromeBrowserState* browser_state_;
// The Objective-C AutofillAgent instance. // The Objective-C AutofillAgent instance.
__strong AutofillAgent* autofill_agent_; __strong AutofillAgent* autofill_agent_;
......
...@@ -43,8 +43,8 @@ id<FormSuggestionProvider> AutofillTabHelper::GetSuggestionProvider() { ...@@ -43,8 +43,8 @@ id<FormSuggestionProvider> AutofillTabHelper::GetSuggestionProvider() {
AutofillTabHelper::AutofillTabHelper( AutofillTabHelper::AutofillTabHelper(
web::WebState* web_state, web::WebState* web_state,
password_manager::PasswordManager* password_manager) password_manager::PasswordManager* password_manager)
: browser_state_(ios::ChromeBrowserState::FromBrowserState( : browser_state_(
web_state->GetBrowserState())), ChromeBrowserState::FromBrowserState(web_state->GetBrowserState())),
autofill_agent_([[AutofillAgent alloc] autofill_agent_([[AutofillAgent alloc]
initWithPrefService:browser_state_->GetPrefs() initWithPrefService:browser_state_->GetPrefs()
webState:web_state]) { webState:web_state]) {
......
...@@ -23,7 +23,7 @@ namespace autofill { ...@@ -23,7 +23,7 @@ namespace autofill {
// static // static
PersonalDataManager* PersonalDataManagerFactory::GetForBrowserState( PersonalDataManager* PersonalDataManagerFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<PersonalDataManager*>( return static_cast<PersonalDataManager*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -48,8 +48,8 @@ PersonalDataManagerFactory::~PersonalDataManagerFactory() {} ...@@ -48,8 +48,8 @@ PersonalDataManagerFactory::~PersonalDataManagerFactory() {}
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
PersonalDataManagerFactory::BuildServiceInstanceFor( PersonalDataManagerFactory::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<PersonalDataManager> service( std::unique_ptr<PersonalDataManager> service(
new PersonalDataManager(GetApplicationContext()->GetApplicationLocale())); new PersonalDataManager(GetApplicationContext()->GetApplicationLocale()));
auto autofill_db = auto autofill_db =
......
...@@ -10,18 +10,19 @@ ...@@ -10,18 +10,19 @@
#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;
namespace autofill { namespace autofill {
class PersonalDataManager; class PersonalDataManager;
// Singleton that owns all PersonalDataManagers and associates them with // Singleton that owns all PersonalDataManagers and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class PersonalDataManagerFactory : public BrowserStateKeyedServiceFactory { class PersonalDataManagerFactory : public BrowserStateKeyedServiceFactory {
public: public:
static PersonalDataManager* GetForBrowserState( static PersonalDataManager* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static PersonalDataManagerFactory* GetInstance(); static PersonalDataManagerFactory* GetInstance();
private: private:
......
...@@ -16,7 +16,7 @@ namespace autofill { ...@@ -16,7 +16,7 @@ namespace autofill {
// static // static
StrikeDatabase* StrikeDatabaseFactory::GetForBrowserState( StrikeDatabase* StrikeDatabaseFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return static_cast<StrikeDatabase*>( return static_cast<StrikeDatabase*>(
GetInstance()->GetServiceForBrowserState(browser_state, true)); GetInstance()->GetServiceForBrowserState(browser_state, true));
} }
...@@ -37,8 +37,8 @@ StrikeDatabaseFactory::~StrikeDatabaseFactory() {} ...@@ -37,8 +37,8 @@ StrikeDatabaseFactory::~StrikeDatabaseFactory() {}
std::unique_ptr<KeyedService> StrikeDatabaseFactory::BuildServiceInstanceFor( std::unique_ptr<KeyedService> StrikeDatabaseFactory::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);
leveldb_proto::ProtoDatabaseProvider* db_provider = leveldb_proto::ProtoDatabaseProvider* db_provider =
chrome_browser_state->GetProtoDatabaseProvider(); chrome_browser_state->GetProtoDatabaseProvider();
......
...@@ -10,18 +10,18 @@ ...@@ -10,18 +10,18 @@
#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;
namespace autofill { namespace autofill {
class StrikeDatabase; class StrikeDatabase;
// Singleton that owns all StrikeDatabases and associates them with // Singleton that owns all StrikeDatabases and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class StrikeDatabaseFactory : public BrowserStateKeyedServiceFactory { class StrikeDatabaseFactory : public BrowserStateKeyedServiceFactory {
public: public:
static StrikeDatabase* GetForBrowserState( static StrikeDatabase* GetForBrowserState(ChromeBrowserState* browser_state);
ios::ChromeBrowserState* browser_state);
static StrikeDatabaseFactory* GetInstance(); static StrikeDatabaseFactory* 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