Chromium Code Reviews| Index: ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm |
| diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm |
| index 0df1af28a4f22c989c334b1f7d501acc80fb752e..add8b361a455ec12127a6cc9bc3f992615e3f6f1 100644 |
| --- a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm |
| +++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm |
| @@ -5,6 +5,8 @@ |
| #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h" |
| #include "base/mac/scoped_nsobject.h" |
| +#import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h" |
| +#include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h" |
| #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h" |
| #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h" |
| #include "ios/chrome/grit/ios_strings.h" |
| @@ -22,19 +24,27 @@ |
| @implementation ContentSuggestionsCoordinator |
| +@synthesize browserState = _browserState; |
| @synthesize visible = _visible; |
| - (void)start { |
| - if (self.visible) { |
| - // Prevent this coordinator from being started twice in a row. |
| + if (self.visible || !self.browserState) { |
| + // Prevent this coordinator from being started twice in a row or without a |
| + // browser state. |
| return; |
| } |
| _visible = YES; |
| + ContentSuggestionsMediator* contentSuggestionsMediator = |
| + [[ContentSuggestionsMediator alloc] |
| + initWithContentService:IOSChromeContentSuggestionsServiceFactory:: |
|
lpromero
2017/01/26 10:10:20
Should you just pass the ContentService to this co
marq (ping after 24h)
2017/01/27 12:44:55
Globally the idea was that coordinators would mani
gambard
2017/01/30 15:19:17
Acknowledged.
I keep the browserState.
|
| + GetForBrowserState(self.browserState)]; |
| + |
| ContentSuggestionsViewController* suggestionsViewController = |
| [[ContentSuggestionsViewController alloc] |
| - initWithStyle:CollectionViewControllerStyleDefault]; |
| + initWithStyle:CollectionViewControllerStyleDefault |
| + dataSource:contentSuggestionsMediator]; |
| suggestionsViewController.suggestionCommandHandler = self; |
| _navigationController = [[UINavigationController alloc] |