OLD | NEW |
---|---|
(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/suggestions/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 @interface SuggestionsCoordinator ()<SuggestionsCommands> { | |
14 base::scoped_nsobject<UINavigationController> _navigationController; | |
15 } | |
16 | |
17 @end | |
18 | |
19 @implementation SuggestionsCoordinator | |
20 | |
21 - (void)start { | |
22 if (_navigationController) { | |
23 // Prevent this coordinator to be started twice in a row. | |
lpromero
2017/01/18 14:37:07
I am not sure if we want to philosophically do it
gambard
2017/01/18 16:54:04
I don't know if we want to do it that way but we a
| |
24 return; | |
25 } | |
26 | |
27 SuggestionsViewController* suggestionsViewController = | |
28 [[[SuggestionsViewController alloc] | |
29 initWithStyle:CollectionViewControllerStyleDefault] autorelease]; | |
30 | |
31 suggestionsViewController.suggestionCommandHandler = self; | |
32 _navigationController.reset([[UINavigationController alloc] | |
33 initWithRootViewController:suggestionsViewController]); | |
34 | |
35 suggestionsViewController.navigationItem.leftBarButtonItem = | |
36 [[[UIBarButtonItem alloc] | |
37 initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE) | |
38 style:UIBarButtonItemStylePlain | |
39 target:self | |
40 action:@selector(stop)] autorelease]; | |
41 | |
42 [self.baseViewController presentViewController:_navigationController | |
43 animated:YES | |
44 completion:nil]; | |
45 } | |
46 | |
47 - (void)stop { | |
48 [[_navigationController presentingViewController] | |
49 dismissViewControllerAnimated:YES | |
50 completion:nil]; | |
51 _navigationController.reset(); | |
52 } | |
53 | |
54 #pragma mark - SuggestionsCommands | |
55 | |
56 - (void)openReadingList { | |
57 } | |
58 | |
59 - (void)openFirstPageOfReadingList { | |
60 } | |
61 | |
62 - (void)addEmptyItem { | |
63 } | |
64 | |
65 @end | |
OLD | NEW |