Chromium Code Reviews| Index: ios/chrome/browser/suggestions/suggestions_coordinator.mm |
| diff --git a/ios/chrome/browser/suggestions/suggestions_coordinator.mm b/ios/chrome/browser/suggestions/suggestions_coordinator.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..59d60912e8aca745e351feecb5a80d84f549936d |
| --- /dev/null |
| +++ b/ios/chrome/browser/suggestions/suggestions_coordinator.mm |
| @@ -0,0 +1,65 @@ |
| +// 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/suggestions/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" |
| + |
| +@interface SuggestionsCoordinator ()<SuggestionsCommands> { |
| + base::scoped_nsobject<UINavigationController> _navigationController; |
| +} |
| + |
| +@end |
| + |
| +@implementation SuggestionsCoordinator |
| + |
| +- (void)start { |
| + if (_navigationController) { |
| + // 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
|
| + return; |
| + } |
| + |
| + SuggestionsViewController* suggestionsViewController = |
| + [[[SuggestionsViewController alloc] |
| + initWithStyle:CollectionViewControllerStyleDefault] autorelease]; |
| + |
| + suggestionsViewController.suggestionCommandHandler = self; |
| + _navigationController.reset([[UINavigationController alloc] |
| + initWithRootViewController:suggestionsViewController]); |
| + |
| + suggestionsViewController.navigationItem.leftBarButtonItem = |
| + [[[UIBarButtonItem alloc] |
| + initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE) |
| + style:UIBarButtonItemStylePlain |
| + target:self |
| + action:@selector(stop)] autorelease]; |
| + |
| + [self.baseViewController presentViewController:_navigationController |
| + animated:YES |
| + completion:nil]; |
| +} |
| + |
| +- (void)stop { |
| + [[_navigationController presentingViewController] |
| + dismissViewControllerAnimated:YES |
| + completion:nil]; |
| + _navigationController.reset(); |
| +} |
| + |
| +#pragma mark - SuggestionsCommands |
| + |
| +- (void)openReadingList { |
| +} |
| + |
| +- (void)openFirstPageOfReadingList { |
| +} |
| + |
| +- (void)addEmptyItem { |
| +} |
| + |
| +@end |