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

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

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

Bug: 1042208
Change-Id: I21abc98656bf320207009b9d3b089756eb1222ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017346
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735289}
parent 198d15b5
...@@ -24,7 +24,7 @@ namespace ios { ...@@ -24,7 +24,7 @@ namespace ios {
// static // static
history::HistoryService* HistoryServiceFactory::GetForBrowserState( history::HistoryService* HistoryServiceFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
ServiceAccessType access_type) { ServiceAccessType access_type) {
// If saving history is disabled, only allow explicit access. // If saving history is disabled, only allow explicit access.
if (access_type != ServiceAccessType::EXPLICIT_ACCESS && if (access_type != ServiceAccessType::EXPLICIT_ACCESS &&
...@@ -39,7 +39,7 @@ history::HistoryService* HistoryServiceFactory::GetForBrowserState( ...@@ -39,7 +39,7 @@ history::HistoryService* HistoryServiceFactory::GetForBrowserState(
// static // static
history::HistoryService* HistoryServiceFactory::GetForBrowserStateIfExists( history::HistoryService* HistoryServiceFactory::GetForBrowserStateIfExists(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
ServiceAccessType access_type) { ServiceAccessType access_type) {
// If saving history is disabled, only allow explicit access. // If saving history is disabled, only allow explicit access.
if (access_type != ServiceAccessType::EXPLICIT_ACCESS && if (access_type != ServiceAccessType::EXPLICIT_ACCESS &&
...@@ -70,8 +70,8 @@ HistoryServiceFactory::~HistoryServiceFactory() { ...@@ -70,8 +70,8 @@ HistoryServiceFactory::~HistoryServiceFactory() {
std::unique_ptr<KeyedService> HistoryServiceFactory::BuildServiceInstanceFor( std::unique_ptr<KeyedService> HistoryServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
std::unique_ptr<history::HistoryService> history_service( std::unique_ptr<history::HistoryService> history_service(
new history::HistoryService( new history::HistoryService(
std::make_unique<HistoryClientImpl>( std::make_unique<HistoryClientImpl>(
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,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;
enum class ServiceAccessType; enum class ServiceAccessType;
namespace history { namespace history {
...@@ -20,14 +20,14 @@ class HistoryService; ...@@ -20,14 +20,14 @@ class HistoryService;
namespace ios { namespace ios {
// Singleton that owns all HistoryServices and associates them with // Singleton that owns all HistoryServices and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class HistoryServiceFactory : public BrowserStateKeyedServiceFactory { class HistoryServiceFactory : public BrowserStateKeyedServiceFactory {
public: public:
static history::HistoryService* GetForBrowserState( static history::HistoryService* GetForBrowserState(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
ServiceAccessType access_type); ServiceAccessType access_type);
static history::HistoryService* GetForBrowserStateIfExists( static history::HistoryService* GetForBrowserStateIfExists(
ios::ChromeBrowserState* browser_state, ChromeBrowserState* browser_state,
ServiceAccessType access_type); ServiceAccessType access_type);
static HistoryServiceFactory* GetInstance(); static HistoryServiceFactory* GetInstance();
......
...@@ -237,8 +237,8 @@ void HistoryTabHelper::WebStateDestroyed(web::WebState* web_state) { ...@@ -237,8 +237,8 @@ void HistoryTabHelper::WebStateDestroyed(web::WebState* web_state) {
} }
history::HistoryService* HistoryTabHelper::GetHistoryService() { history::HistoryService* HistoryTabHelper::GetHistoryService() {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState()); ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState());
if (browser_state->IsOffTheRecord()) if (browser_state->IsOffTheRecord())
return nullptr; return nullptr;
......
...@@ -23,7 +23,7 @@ namespace ios { ...@@ -23,7 +23,7 @@ namespace ios {
// static // static
scoped_refptr<history::TopSites> TopSitesFactory::GetForBrowserState( scoped_refptr<history::TopSites> TopSitesFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
return base::WrapRefCounted(static_cast<history::TopSites*>( return base::WrapRefCounted(static_cast<history::TopSites*>(
GetInstance()->GetServiceForBrowserState(browser_state, true).get())); GetInstance()->GetServiceForBrowserState(browser_state, true).get()));
} }
...@@ -46,8 +46,8 @@ TopSitesFactory::~TopSitesFactory() { ...@@ -46,8 +46,8 @@ TopSitesFactory::~TopSitesFactory() {
scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor( scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
history::HistoryService* history_service = history::HistoryService* history_service =
ios::HistoryServiceFactory::GetForBrowserState( ios::HistoryServiceFactory::GetForBrowserState(
browser_state, ServiceAccessType::EXPLICIT_ACCESS); browser_state, ServiceAccessType::EXPLICIT_ACCESS);
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.h" #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
class ChromeBrowserState;
namespace history { namespace history {
class TopSites; class TopSites;
...@@ -21,7 +22,7 @@ namespace ios { ...@@ -21,7 +22,7 @@ namespace ios {
class TopSitesFactory : public RefcountedBrowserStateKeyedServiceFactory { class TopSitesFactory : public RefcountedBrowserStateKeyedServiceFactory {
public: public:
static scoped_refptr<history::TopSites> GetForBrowserState( static scoped_refptr<history::TopSites> GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static TopSitesFactory* GetInstance(); static TopSitesFactory* GetInstance();
private: private:
......
...@@ -20,7 +20,7 @@ namespace { ...@@ -20,7 +20,7 @@ namespace {
// Returns true if the user is signed-in and full history sync is enabled, // Returns true if the user is signed-in and full history sync is enabled,
// false otherwise. // false otherwise.
bool IsHistorySyncEnabled(ios::ChromeBrowserState* browser_state) { bool IsHistorySyncEnabled(ChromeBrowserState* browser_state) {
syncer::SyncService* sync_service = syncer::SyncService* sync_service =
ProfileSyncServiceFactory::GetForBrowserState(browser_state); ProfileSyncServiceFactory::GetForBrowserState(browser_state);
return sync_service && sync_service->IsSyncFeatureActive() && return sync_service && sync_service->IsSyncFeatureActive() &&
...@@ -32,7 +32,7 @@ bool IsHistorySyncEnabled(ios::ChromeBrowserState* browser_state) { ...@@ -32,7 +32,7 @@ bool IsHistorySyncEnabled(ios::ChromeBrowserState* browser_state) {
// static // static
history::WebHistoryService* WebHistoryServiceFactory::GetForBrowserState( history::WebHistoryService* WebHistoryServiceFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) { ChromeBrowserState* browser_state) {
// Ensure that the service is not instantiated or used if the user is not // Ensure that the service is not instantiated or used if the user is not
// signed into sync, or if web history is not enabled. // signed into sync, or if web history is not enabled.
if (!IsHistorySyncEnabled(browser_state)) if (!IsHistorySyncEnabled(browser_state))
...@@ -61,8 +61,8 @@ WebHistoryServiceFactory::~WebHistoryServiceFactory() { ...@@ -61,8 +61,8 @@ WebHistoryServiceFactory::~WebHistoryServiceFactory() {
std::unique_ptr<KeyedService> WebHistoryServiceFactory::BuildServiceInstanceFor( std::unique_ptr<KeyedService> WebHistoryServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const { web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context); ChromeBrowserState::FromBrowserState(context);
return std::make_unique<history::WebHistoryService>( return std::make_unique<history::WebHistoryService>(
IdentityManagerFactory::GetForBrowserState(browser_state), IdentityManagerFactory::GetForBrowserState(browser_state),
base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,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 history { namespace history {
class WebHistoryService; class WebHistoryService;
...@@ -18,11 +19,11 @@ class WebHistoryService; ...@@ -18,11 +19,11 @@ class WebHistoryService;
namespace ios { namespace ios {
// Singleton that owns all WebHistoryServices and associates them with // Singleton that owns all WebHistoryServices and associates them with
// ios::ChromeBrowserState. // ChromeBrowserState.
class WebHistoryServiceFactory : public BrowserStateKeyedServiceFactory { class WebHistoryServiceFactory : public BrowserStateKeyedServiceFactory {
public: public:
static history::WebHistoryService* GetForBrowserState( static history::WebHistoryService* GetForBrowserState(
ios::ChromeBrowserState* browser_state); ChromeBrowserState* browser_state);
static WebHistoryServiceFactory* GetInstance(); static WebHistoryServiceFactory* 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