| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.h" | 5 #import "ios/clean/chrome/browser/ui/ntp/ntp_home_coordinator.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" | |
| 8 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" | 7 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" |
| 8 #import "ios/chrome/browser/ui/ntp/google_landing_view_controller.h" |
| 9 #import "ios/clean/chrome/browser/ui/ntp/ntp_home_mediator.h" | 9 #import "ios/clean/chrome/browser/ui/ntp/ntp_home_mediator.h" |
| 10 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | 10 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
| 11 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" | 11 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" |
| 12 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" | 12 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" |
| 13 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) | 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." | 15 #error "This file requires ARC support." |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 @interface NTPHomeCoordinator () | 18 @interface NTPHomeCoordinator () |
| 19 @property(nonatomic, strong) NTPHomeMediator* mediator; | 19 @property(nonatomic, strong) NTPHomeMediator* mediator; |
| 20 @property(nonatomic, strong) GoogleLandingMediator* googleLandingMediator; | 20 @property(nonatomic, strong) GoogleLandingMediator* googleLandingMediator; |
| 21 @property(nonatomic, strong) GoogleLandingController* viewController; | 21 @property(nonatomic, strong) GoogleLandingViewController* viewController; |
| 22 @end | 22 @end |
| 23 | 23 |
| 24 @implementation NTPHomeCoordinator | 24 @implementation NTPHomeCoordinator |
| 25 @synthesize mediator = _mediator; | 25 @synthesize mediator = _mediator; |
| 26 @synthesize googleLandingMediator = _googleLandingMediator; | 26 @synthesize googleLandingMediator = _googleLandingMediator; |
| 27 @synthesize viewController = _viewController; | 27 @synthesize viewController = _viewController; |
| 28 | 28 |
| 29 - (void)start { | 29 - (void)start { |
| 30 // PLACEHOLDER: self.mediator and self.oldMediator should be merged together. | 30 // PLACEHOLDER: self.mediator and self.oldMediator should be merged together. |
| 31 self.mediator = [[NTPHomeMediator alloc] init]; | 31 self.mediator = [[NTPHomeMediator alloc] init]; |
| 32 self.mediator.dispatcher = static_cast<id>(self.browser->dispatcher()); | 32 self.mediator.dispatcher = static_cast<id>(self.browser->dispatcher()); |
| 33 | 33 |
| 34 // PLACEHOLDER: These will go elsewhere. | 34 // PLACEHOLDER: These will go elsewhere. |
| 35 [self.browser->dispatcher() startDispatchingToTarget:self.mediator | 35 [self.browser->dispatcher() startDispatchingToTarget:self.mediator |
| 36 forProtocol:@protocol(UrlLoader)]; | 36 forProtocol:@protocol(UrlLoader)]; |
| 37 [self.browser->dispatcher() | 37 [self.browser->dispatcher() |
| 38 startDispatchingToTarget:self.mediator | 38 startDispatchingToTarget:self.mediator |
| 39 forProtocol:@protocol(OmniboxFocuser)]; | 39 forProtocol:@protocol(OmniboxFocuser)]; |
| 40 self.viewController = [[GoogleLandingController alloc] init]; | 40 self.viewController = [[GoogleLandingViewController alloc] init]; |
| 41 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); | 41 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); |
| 42 self.googleLandingMediator = [[GoogleLandingMediator alloc] | 42 self.googleLandingMediator = [[GoogleLandingMediator alloc] |
| 43 initWithConsumer:self.viewController | 43 initWithConsumer:self.viewController |
| 44 browserState:self.browser->browser_state() | 44 browserState:self.browser->browser_state() |
| 45 dispatcher:static_cast<id>(self.browser->dispatcher()) | 45 dispatcher:static_cast<id>(self.browser->dispatcher()) |
| 46 webStateList:&self.browser->web_state_list()]; | 46 webStateList:&self.browser->web_state_list()]; |
| 47 self.viewController.dataSource = self.googleLandingMediator; | 47 self.viewController.dataSource = self.googleLandingMediator; |
| 48 [super start]; | 48 [super start]; |
| 49 } | 49 } |
| 50 | 50 |
| 51 - (void)stop { | 51 - (void)stop { |
| 52 [super stop]; | 52 [super stop]; |
| 53 [self.googleLandingMediator shutdown]; | 53 [self.googleLandingMediator shutdown]; |
| 54 | 54 |
| 55 [self.browser->dispatcher() stopDispatchingForProtocol:@protocol(UrlLoader)]; | 55 [self.browser->dispatcher() stopDispatchingForProtocol:@protocol(UrlLoader)]; |
| 56 [self.browser->dispatcher() | 56 [self.browser->dispatcher() |
| 57 stopDispatchingForProtocol:@protocol(OmniboxFocuser)]; | 57 stopDispatchingForProtocol:@protocol(OmniboxFocuser)]; |
| 58 [super stop]; | 58 [super stop]; |
| 59 } | 59 } |
| 60 | 60 |
| 61 @end | 61 @end |
| OLD | NEW |