Chromium Code Reviews| 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" | 7 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" |
| 8 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" | 8 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.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/coordinators/browser_coordinator+internal. h" | 12 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal. h" |
| 12 | 13 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) | 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." | 15 #error "This file requires ARC support." |
| 15 #endif | 16 #endif |
| 16 | 17 |
| 17 @interface NTPHomeCoordinator () | 18 @interface NTPHomeCoordinator () |
| 18 @property(nonatomic, strong) NTPHomeMediator* mediator; | 19 @property(nonatomic, strong) NTPHomeMediator* mediator; |
| 19 @property(nonatomic, strong) GoogleLandingMediator* googleLandingMediator; | 20 @property(nonatomic, strong) GoogleLandingMediator* googleLandingMediator; |
| 20 @property(nonatomic, strong) GoogleLandingController* viewController; | 21 @property(nonatomic, strong) GoogleLandingController* viewController; |
| 21 @end | 22 @end |
| 22 | 23 |
| 23 @implementation NTPHomeCoordinator | 24 @implementation NTPHomeCoordinator |
| 24 @synthesize mediator = _mediator; | 25 @synthesize mediator = _mediator; |
| 25 @synthesize googleLandingMediator = _googleLandingMediator; | 26 @synthesize googleLandingMediator = _googleLandingMediator; |
| 26 @synthesize viewController = _viewController; | 27 @synthesize viewController = _viewController; |
| 27 | 28 |
| 28 - (void)start { | 29 - (void)start { |
| 29 // PLACEHOLDER: self.mediator and self.oldMediator should be merged together. | 30 // PLACEHOLDER: self.mediator and self.oldMediator should be merged together. |
| 30 self.mediator = [[NTPHomeMediator alloc] init]; | 31 self.mediator = [[NTPHomeMediator alloc] init]; |
| 31 self.mediator.dispatcher = static_cast<id>(self.browser->dispatcher()); | 32 self.mediator.dispatcher = static_cast<id>(self.browser->dispatcher()); |
| 33 | |
| 34 // PLACEHOLDER: These will go elsewhere. | |
| 35 [self.browser->dispatcher() startDispatchingToTarget:self.mediator | |
| 36 forProtocol:@protocol(UrlLoader)]; | |
| 37 [self.browser->dispatcher() | |
| 38 startDispatchingToTarget:self.mediator | |
| 39 forProtocol:@protocol(OmniboxFocuser)]; | |
| 32 self.viewController = [[GoogleLandingController alloc] init]; | 40 self.viewController = [[GoogleLandingController alloc] init]; |
| 41 self.viewController.dispatcher = static_cast<id>(self.browser->dispatcher()); | |
| 33 self.googleLandingMediator = [[GoogleLandingMediator alloc] | 42 self.googleLandingMediator = [[GoogleLandingMediator alloc] |
| 34 initWithConsumer:self.viewController | 43 initWithConsumer:self.viewController |
| 35 browserState:self.browser->browser_state() | 44 browserState:self.browser->browser_state() |
| 36 loader:self.mediator | 45 dispatcher:static_cast<id>(self.browser->dispatcher()) |
| 37 focuser:self.mediator | 46 webStateList:&self.browser->web_state_list()]; |
| 38 webToolbarDelegate:nil | |
| 39 webStateList:&self.browser->web_state_list()]; | |
| 40 self.viewController.dataSource = self.googleLandingMediator; | 47 self.viewController.dataSource = self.googleLandingMediator; |
| 41 [super start]; | 48 [super start]; |
| 42 } | 49 } |
| 43 | 50 |
| 44 - (void)stop { | 51 - (void)stop { |
| 45 [super stop]; | 52 [super stop]; |
| 46 [self.googleLandingMediator shutdown]; | 53 [self.googleLandingMediator shutdown]; |
| 54 | |
| 55 [self.browser->dispatcher() stopDispatchingForProtocol:@protocol(UrlLoader)]; | |
| 56 [self.browser->dispatcher() | |
| 57 stopDispatchingForProtocol:@protocol(OmniboxFocuser)]; | |
| 58 [super stop]; | |
|
rohitrao (ping after 24h)
2017/04/28 11:56:22
You've got two [super stop]s in here. Bad merge?
justincohen
2017/04/28 14:02:20
bad merge!
| |
| 47 } | 59 } |
| 48 | 60 |
| 49 @end | 61 @end |
| OLD | NEW |