Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ios/showcase/ntp/sc_ntp_coordinator.mm

Issue 2712743005: Add NTPViewController to Showcase. (Closed)
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/showcase/ntp/sc_ntp_coordinator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « ios/showcase/ntp/sc_ntp_coordinator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698