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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/showcase/ntp/sc_ntp_coordinator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« 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