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

Unified Diff: ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm

Issue 2643753002: Add the suggestions UI in chrome (Closed)
Patch Set: Update comments Created 3 years, 11 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
Index: ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
new file mode 100644
index 0000000000000000000000000000000000000000..39c3f1010ce8f43fed2d58bc8b7d045dd7c247ae
--- /dev/null
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
@@ -0,0 +1,77 @@
+// 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/chrome/browser/content_suggestions/content_suggestions_coordinator.h"
+
+#include "base/mac/scoped_nsobject.h"
+#import "ios/chrome/browser/ui/suggestions/suggestions_commands.h"
+#import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h"
+#include "ios/chrome/grit/ios_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface ContentSuggestionsCoordinator ()<SuggestionsCommands> {
+ UINavigationController* _navigationController;
+}
+
+@end
+
+@implementation ContentSuggestionsCoordinator
+
+@synthesize visible = _visible;
+
+- (void)start {
+ if (self.visible) {
+ // Prevent this coordinator from being started twice in a row.
+ return;
+ }
+
+ _visible = YES;
+
+ SuggestionsViewController* suggestionsViewController =
+ [[SuggestionsViewController alloc]
+ initWithStyle:CollectionViewControllerStyleDefault];
+
+ suggestionsViewController.suggestionCommandHandler = self;
+ _navigationController = [[UINavigationController alloc]
+ initWithRootViewController:suggestionsViewController];
+
+ suggestionsViewController.navigationItem.leftBarButtonItem =
+ [[UIBarButtonItem alloc]
+ initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE)
+ style:UIBarButtonItemStylePlain
+ target:self
+ action:@selector(stop)];
+
+ [self.baseViewController presentViewController:_navigationController
+ animated:YES
+ completion:nil];
+}
+
+- (void)stop {
+ [[_navigationController presentingViewController]
+ dismissViewControllerAnimated:YES
+ completion:nil];
+ _navigationController = nil;
+ _visible = NO;
+}
+
+#pragma mark - SuggestionsCommands
+
+- (void)openReadingList {
+}
+
+- (void)openFirstPageOfReadingList {
+}
+
+- (void)addEmptyItem {
+}
+
+- (void)openFaviconAtIndex:(NSInteger)index {
+}
+
+@end
« no previous file with comments | « ios/chrome/browser/content_suggestions/content_suggestions_coordinator.h ('k') | ios/chrome/browser/experimental_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698