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

Side by Side 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 unified diff | Download patch
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/chrome/browser/content_suggestions/content_suggestions_coordinator. h"
6
7 #include "base/mac/scoped_nsobject.h"
8 #import "ios/chrome/browser/ui/suggestions/suggestions_commands.h"
9 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h"
10 #include "ios/chrome/grit/ios_strings.h"
11 #include "ui/base/l10n/l10n_util.h"
12
13 #if !defined(__has_feature) || !__has_feature(objc_arc)
14 #error "This file requires ARC support."
15 #endif
16
17 @interface ContentSuggestionsCoordinator ()<SuggestionsCommands> {
18 UINavigationController* _navigationController;
19 }
20
21 @end
22
23 @implementation ContentSuggestionsCoordinator
24
25 - (void)start {
26 if (_navigationController) {
27 // Prevent this coordinator to be started twice in a row.
28 return;
29 }
30
31 SuggestionsViewController* suggestionsViewController =
32 [[SuggestionsViewController alloc]
33 initWithStyle:CollectionViewControllerStyleDefault];
34
35 suggestionsViewController.suggestionCommandHandler = self;
36 _navigationController = [[UINavigationController alloc]
37 initWithRootViewController:suggestionsViewController];
38
39 suggestionsViewController.navigationItem.leftBarButtonItem =
40 [[UIBarButtonItem alloc]
41 initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE)
42 style:UIBarButtonItemStylePlain
43 target:self
44 action:@selector(stop)];
45
46 [self.baseViewController presentViewController:_navigationController
47 animated:YES
48 completion:nil];
49 }
50
51 - (void)stop {
52 [[_navigationController presentingViewController]
53 dismissViewControllerAnimated:YES
54 completion:nil];
55 _navigationController = nil;
56 }
57
58 #pragma mark - SuggestionsCommands
59
60 - (void)openReadingList {
61 }
62
63 - (void)openFirstPageOfReadingList {
64 }
65
66 - (void)addEmptyItem {
67 }
68
69 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698