Index: ios/showcase/ntp/sc_ntp_coordinator.mm |
diff --git a/ios/showcase/ntp/sc_ntp_coordinator.mm b/ios/showcase/ntp/sc_ntp_coordinator.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..98301fc6e5794ce2635535c60387894e2e74028c |
--- /dev/null |
+++ b/ios/showcase/ntp/sc_ntp_coordinator.mm |
@@ -0,0 +1,46 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "ios/showcase/ntp/sc_ntp_coordinator.h" |
+ |
+#import "ios/chrome/browser/ui/ntp/new_tab_page_bar_item.h" |
+#import "ios/clean/chrome/browser/ui/commands/ntp_commands.h" |
+#import "ios/clean/chrome/browser/ui/ntp/ntp_view_controller.h" |
+#import "ios/showcase/common/protocol_alerter.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+@interface SCNTPCoordinator () |
+@property(nonatomic, strong) ProtocolAlerter* alerter; |
+@end |
+ |
+@implementation SCNTPCoordinator |
+ |
+@synthesize baseViewController; |
+@synthesize alerter = _alerter; |
+ |
+- (void)start { |
+ NTPViewController* ntp = [[NTPViewController alloc] init]; |
+ |
+ self.alerter = |
+ [[ProtocolAlerter alloc] initWithProtocols:@[ @protocol(NTPCommands) ]]; |
+ self.alerter.baseViewController = self.baseViewController; |
+ ntp.dispatcher = static_cast<id<NTPCommands>>(self.alerter); |
+ |
+ NewTabPageBarItem* item1 = [NewTabPageBarItem |
+ newTabPageBarItemWithTitle:@"Item 1" |
+ identifier:0 |
+ image:[UIImage imageNamed:@"ntp_mv_search"]]; |
+ NewTabPageBarItem* item2 = [NewTabPageBarItem |
+ newTabPageBarItemWithTitle:@"Item 2" |
+ identifier:0 |
+ image:[UIImage imageNamed:@"ntp_bookmarks"]]; |
+ [ntp setBarItems:@[ item1, item2 ]]; |
+ |
+ [self.baseViewController pushViewController:ntp animated:YES]; |
+} |
+ |
+@end |