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 {
// static
history::HistoryService* HistoryServiceFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state,
ChromeBrowserState* browser_state,
ServiceAccessType access_type) {
// If saving history is disabled, only allow explicit access.
if (access_type != ServiceAccessType::EXPLICIT_ACCESS &&
......@@ -39,7 +39,7 @@ history::HistoryService* HistoryServiceFactory::GetForBrowserState(
// static
history::HistoryService* HistoryServiceFactory::GetForBrowserStateIfExists(
ios::ChromeBrowserState* browser_state,
ChromeBrowserState* browser_state,
ServiceAccessType access_type) {
// If saving history is disabled, only allow explicit access.
if (access_type != ServiceAccessType::EXPLICIT_ACCESS &&
......@@ -70,8 +70,8 @@ HistoryServiceFactory::~HistoryServiceFactory() {
std::unique_ptr<KeyedService> HistoryServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context);
ChromeBrowserState* browser_state =
ChromeBrowserState::FromBrowserState(context);
std::unique_ptr<history::HistoryService> history_service(
new history::HistoryService(
std::make_unique<HistoryClientImpl>(
......
......@@ -10,8 +10,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;
enum class ServiceAccessType;
namespace history {
......@@ -20,14 +20,14 @@ class HistoryService;
namespace ios {
// Singleton that owns all HistoryServices and associates them with
// ios::ChromeBrowserState.
// ChromeBrowserState.
class HistoryServiceFactory : public BrowserStateKeyedServiceFactory {
public:
static history::HistoryService* GetForBrowserState(
ios::ChromeBrowserState* browser_state,
ChromeBrowserState* browser_state,
ServiceAccessType access_type);
static history::HistoryService* GetForBrowserStateIfExists(
ios::ChromeBrowserState* browser_state,
ChromeBrowserState* browser_state,
ServiceAccessType access_type);
static HistoryServiceFactory* GetInstance();
......
......@@ -237,8 +237,8 @@ void HistoryTabHelper::WebStateDestroyed(web::WebState* web_state) {
}
history::HistoryService* HistoryTabHelper::GetHistoryService() {
ios::ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState());
ChromeBrowserState* browser_state =
ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState());
if (browser_state->IsOffTheRecord())
return nullptr;
......
......@@ -23,7 +23,7 @@ namespace ios {
// static
scoped_refptr<history::TopSites> TopSitesFactory::GetForBrowserState(
ios::ChromeBrowserState* browser_state) {
ChromeBrowserState* browser_state) {
return base::WrapRefCounted(static_cast<history::TopSites*>(
GetInstance()->GetServiceForBrowserState(browser_state, true).get()));
}
......@@ -46,8 +46,8 @@ TopSitesFactory::~TopSitesFactory() {
scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor(
web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context);
ChromeBrowserState* browser_state =
ChromeBrowserState::FromBrowserState(context);
history::HistoryService* history_service =
ios::HistoryServiceFactory::GetForBrowserState(
browser_state, ServiceAccessType::EXPLICIT_ACCESS);
......
......@@ -9,7 +9,8 @@
#include "base/memory/ref_counted.h"
#include "base/no_destructor.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 {
class TopSites;
......@@ -21,7 +22,7 @@ namespace ios {
class TopSitesFactory : public RefcountedBrowserStateKeyedServiceFactory {
public:
static scoped_refptr<history::TopSites> GetForBrowserState(
ios::ChromeBrowserState* browser_state);
ChromeBrowserState* browser_state);
static TopSitesFactory* GetInstance();
private:
......
......@@ -20,7 +20,7 @@ namespace {
// Returns true if the user is signed-in and full history sync is enabled,
// false otherwise.
bool IsHistorySyncEnabled(ios::ChromeBrowserState* browser_state) {
bool IsHistorySyncEnabled(ChromeBrowserState* browser_state) {
syncer::SyncService* sync_service =
ProfileSyncServiceFactory::GetForBrowserState(browser_state);
return sync_service && sync_service->IsSyncFeatureActive() &&
......@@ -32,7 +32,7 @@ bool IsHistorySyncEnabled(ios::ChromeBrowserState* browser_state) {
// static
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
// signed into sync, or if web history is not enabled.
if (!IsHistorySyncEnabled(browser_state))
......@@ -61,8 +61,8 @@ WebHistoryServiceFactory::~WebHistoryServiceFactory() {
std::unique_ptr<KeyedService> WebHistoryServiceFactory::BuildServiceInstanceFor(
web::BrowserState* context) const {
ios::ChromeBrowserState* browser_state =
ios::ChromeBrowserState::FromBrowserState(context);
ChromeBrowserState* browser_state =
ChromeBrowserState::FromBrowserState(context);
return std::make_unique<history::WebHistoryService>(
IdentityManagerFactory::GetForBrowserState(browser_state),
base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>(
......
......@@ -10,7 +10,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;
namespace history {
class WebHistoryService;
......@@ -18,11 +19,11 @@ class WebHistoryService;
namespace ios {
// Singleton that owns all WebHistoryServices and associates them with
// ios::ChromeBrowserState.
// ChromeBrowserState.
class WebHistoryServiceFactory : public BrowserStateKeyedServiceFactory {
public:
static history::WebHistoryService* GetForBrowserState(
ios::ChromeBrowserState* browser_state);
ChromeBrowserState* browser_state);
static WebHistoryServiceFactory* 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