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/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 @synthesize visible = _visible; |
| 26 |
| 27 - (void)start { |
| 28 if (self.visible) { |
| 29 // Prevent this coordinator from being started twice in a row. |
| 30 return; |
| 31 } |
| 32 |
| 33 _visible = YES; |
| 34 |
| 35 SuggestionsViewController* suggestionsViewController = |
| 36 [[SuggestionsViewController alloc] |
| 37 initWithStyle:CollectionViewControllerStyleDefault]; |
| 38 |
| 39 suggestionsViewController.suggestionCommandHandler = self; |
| 40 _navigationController = [[UINavigationController alloc] |
| 41 initWithRootViewController:suggestionsViewController]; |
| 42 |
| 43 suggestionsViewController.navigationItem.leftBarButtonItem = |
| 44 [[UIBarButtonItem alloc] |
| 45 initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE) |
| 46 style:UIBarButtonItemStylePlain |
| 47 target:self |
| 48 action:@selector(stop)]; |
| 49 |
| 50 [self.baseViewController presentViewController:_navigationController |
| 51 animated:YES |
| 52 completion:nil]; |
| 53 } |
| 54 |
| 55 - (void)stop { |
| 56 [[_navigationController presentingViewController] |
| 57 dismissViewControllerAnimated:YES |
| 58 completion:nil]; |
| 59 _navigationController = nil; |
| 60 _visible = NO; |
| 61 } |
| 62 |
| 63 #pragma mark - SuggestionsCommands |
| 64 |
| 65 - (void)openReadingList { |
| 66 } |
| 67 |
| 68 - (void)openFirstPageOfReadingList { |
| 69 } |
| 70 |
| 71 - (void)addEmptyItem { |
| 72 } |
| 73 |
| 74 - (void)openFaviconAtIndex:(NSInteger)index { |
| 75 } |
| 76 |
| 77 @end |
OLD | NEW |