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

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

Issue 2643753002: Add the suggestions UI in chrome (Closed)
Patch Set: Move to content suggestions 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..6a41aacc32fbab7f3ceb6cefddeabb6d46ea9abc
--- /dev/null
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
@@ -0,0 +1,69 @@
+// 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
+
+- (void)start {
+ if (_navigationController) {
+ // Prevent this coordinator to be started twice in a row.
+ return;
+ }
+
+ 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;
+}
+
+#pragma mark - SuggestionsCommands
+
+- (void)openReadingList {
+}
+
+- (void)openFirstPageOfReadingList {
+}
+
+- (void)addEmptyItem {
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698