Commit 10b91b2b authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

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

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

Bug: 1042208
Change-Id: I0e14f7124e29be264b164c36985bc0d2e5de5ab6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017505Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734911}
parent a47a2f0f
...@@ -62,7 +62,7 @@ ContentSuggestion CreateSuggestion(Category category, ...@@ -62,7 +62,7 @@ ContentSuggestion CreateSuggestion(Category category,
@implementation ContentSuggestionsAppInterface @implementation ContentSuggestionsAppInterface
+ (void)setUpService { + (void)setUpService {
ios::ChromeBrowserState* browserState = ChromeBrowserState* browserState =
chrome_test_util::GetOriginalBrowserState(); chrome_test_util::GetOriginalBrowserState();
// Sets the ContentSuggestionsService associated with this browserState to a // Sets the ContentSuggestionsService associated with this browserState to a
// service with no provider registered, allowing to register fake providers // service with no provider registered, allowing to register fake providers
...@@ -79,7 +79,7 @@ ContentSuggestion CreateSuggestion(Category category, ...@@ -79,7 +79,7 @@ ContentSuggestion CreateSuggestion(Category category,
} }
+ (void)resetService { + (void)resetService {
ios::ChromeBrowserState* browserState = ChromeBrowserState* browserState =
chrome_test_util::GetOriginalBrowserState(); chrome_test_util::GetOriginalBrowserState();
// Resets the Service associated with this browserState to a new service with // Resets the Service associated with this browserState to a new service with
...@@ -136,7 +136,7 @@ ContentSuggestion CreateSuggestion(Category category, ...@@ -136,7 +136,7 @@ ContentSuggestion CreateSuggestion(Category category,
+ (NSString*)defaultSearchEngine { + (NSString*)defaultSearchEngine {
// Get the default Search Engine. // Get the default Search Engine.
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
chrome_test_util::GetOriginalBrowserState(); chrome_test_util::GetOriginalBrowserState();
TemplateURLService* service = TemplateURLService* service =
ios::TemplateURLServiceFactory::GetForBrowserState(browser_state); ios::TemplateURLServiceFactory::GetForBrowserState(browser_state);
...@@ -149,7 +149,7 @@ ContentSuggestion CreateSuggestion(Category category, ...@@ -149,7 +149,7 @@ ContentSuggestion CreateSuggestion(Category category,
base::SysNSStringToUTF16(defaultSearchEngine); base::SysNSStringToUTF16(defaultSearchEngine);
// Set the search engine back to the default in case the test fails before // Set the search engine back to the default in case the test fails before
// cleaning it up. // cleaning it up.
ios::ChromeBrowserState* browser_state = ChromeBrowserState* browser_state =
chrome_test_util::GetOriginalBrowserState(); chrome_test_util::GetOriginalBrowserState();
TemplateURLService* service = TemplateURLService* service =
ios::TemplateURLServiceFactory::GetForBrowserState(browser_state); ios::TemplateURLServiceFactory::GetForBrowserState(browser_state);
......
...@@ -5,9 +5,10 @@ ...@@ -5,9 +5,10 @@
#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COORDINATOR_H_ #ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COORDINATOR_H_
#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COORDINATOR_H_ #define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_COORDINATOR_H_
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
#import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" #import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h"
class ChromeBrowserState;
namespace web { namespace web {
class WebState; class WebState;
} }
...@@ -25,7 +26,7 @@ class WebState; ...@@ -25,7 +26,7 @@ class WebState;
@interface ContentSuggestionsCoordinator : ChromeCoordinator @interface ContentSuggestionsCoordinator : ChromeCoordinator
// BrowserState used to create the ContentSuggestionFactory. // BrowserState used to create the ContentSuggestionFactory.
@property(nonatomic, assign) ios::ChromeBrowserState* browserState; @property(nonatomic, assign) ChromeBrowserState* browserState;
// URLLoader used to open pages. // URLLoader used to open pages.
@property(nonatomic, assign) web::WebState* webState; @property(nonatomic, assign) web::WebState* webState;
@property(nonatomic, weak) id<NewTabPageControllerDelegate> toolbarDelegate; @property(nonatomic, weak) id<NewTabPageControllerDelegate> toolbarDelegate;
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
contentSuggestionsService->user_classifier()->OnEvent( contentSuggestionsService->user_classifier()->OnEvent(
ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN); ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN);
PrefService* prefs = PrefService* prefs =
ios::ChromeBrowserState::FromBrowserState(self.browserState)->GetPrefs(); ChromeBrowserState::FromBrowserState(self.browserState)->GetPrefs();
bool contentSuggestionsEnabled = bool contentSuggestionsEnabled =
prefs->GetBoolean(prefs::kArticlesForYouEnabled); prefs->GetBoolean(prefs::kArticlesForYouEnabled);
bool contentSuggestionsVisible = bool contentSuggestionsVisible =
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state_forward.h"
#import "ios/chrome/browser/metrics/new_tab_page_uma.h" #import "ios/chrome/browser/metrics/new_tab_page_uma.h"
class ChromeBrowserState;
namespace web { namespace web {
class WebState; class WebState;
} }
...@@ -24,7 +25,7 @@ void RecordNTPImpression(ntp_home::IOSNTPImpression impression_type); ...@@ -24,7 +25,7 @@ void RecordNTPImpression(ntp_home::IOSNTPImpression impression_type);
// Metrics recorder for the action used to potentially leave the NTP. // Metrics recorder for the action used to potentially leave the NTP.
@interface NTPHomeMetrics : NSObject @interface NTPHomeMetrics : NSObject
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState - (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState
webState:(web::WebState*)webState webState:(web::WebState*)webState
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
......
...@@ -19,7 +19,7 @@ void RecordNTPImpression(IOSNTPImpression impression_type) { ...@@ -19,7 +19,7 @@ void RecordNTPImpression(IOSNTPImpression impression_type) {
} // namespace ntp_home } // namespace ntp_home
@interface NTPHomeMetrics () @interface NTPHomeMetrics ()
@property(nonatomic, assign) ios::ChromeBrowserState* browserState; @property(nonatomic, assign) ChromeBrowserState* browserState;
@property(nonatomic, assign) web::WebState* webState; @property(nonatomic, assign) web::WebState* webState;
@end @end
...@@ -27,7 +27,7 @@ void RecordNTPImpression(IOSNTPImpression impression_type) { ...@@ -27,7 +27,7 @@ void RecordNTPImpression(IOSNTPImpression impression_type) {
@synthesize browserState = _browserState; @synthesize browserState = _browserState;
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState - (instancetype)initWithBrowserState:(ChromeBrowserState*)browserState
webState:(web::WebState*)webState { webState:(web::WebState*)webState {
self = [super init]; self = [super init];
if (self) { if (self) {
......
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