OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/showcase/ntp/sc_ntp_coordinator.h" |
| 6 |
| 7 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar_item.h" |
| 8 #import "ios/clean/chrome/browser/ui/commands/ntp_commands.h" |
| 9 #import "ios/clean/chrome/browser/ui/ntp/ntp_view_controller.h" |
| 10 #import "ios/showcase/common/protocol_alerter.h" |
| 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 16 @interface SCNTPCoordinator () |
| 17 @property(nonatomic, strong) ProtocolAlerter* alerter; |
| 18 @end |
| 19 |
| 20 @implementation SCNTPCoordinator |
| 21 |
| 22 @synthesize baseViewController; |
| 23 @synthesize alerter = _alerter; |
| 24 |
| 25 - (void)start { |
| 26 NTPViewController* ntp = [[NTPViewController alloc] init]; |
| 27 |
| 28 self.alerter = |
| 29 [[ProtocolAlerter alloc] initWithProtocols:@[ @protocol(NTPCommands) ]]; |
| 30 self.alerter.baseViewController = self.baseViewController; |
| 31 ntp.dispatcher = static_cast<id<NTPCommands>>(self.alerter); |
| 32 |
| 33 NewTabPageBarItem* item1 = [NewTabPageBarItem |
| 34 newTabPageBarItemWithTitle:@"Item 1" |
| 35 identifier:0 |
| 36 image:[UIImage imageNamed:@"ntp_mv_search"]]; |
| 37 NewTabPageBarItem* item2 = [NewTabPageBarItem |
| 38 newTabPageBarItemWithTitle:@"Item 2" |
| 39 identifier:0 |
| 40 image:[UIImage imageNamed:@"ntp_bookmarks"]]; |
| 41 [ntp setBarItems:@[ item1, item2 ]]; |
| 42 |
| 43 [self.baseViewController pushViewController:ntp animated:YES]; |
| 44 } |
| 45 |
| 46 @end |
OLD | NEW |