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

Side by Side Diff: ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm

Issue 2644123003: Move ios/ui/suggestions to ios/ui/content_suggestions (Closed)
Patch Set: Rebase Created 3 years, 10 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator. h" 5 #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator. h"
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #import "ios/chrome/browser/ui/suggestions/suggestions_commands.h" 8 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands. h"
9 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h" 9 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h"
10 #include "ios/chrome/grit/ios_strings.h" 10 #include "ios/chrome/grit/ios_strings.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 12
13 #if !defined(__has_feature) || !__has_feature(objc_arc) 13 #if !defined(__has_feature) || !__has_feature(objc_arc)
14 #error "This file requires ARC support." 14 #error "This file requires ARC support."
15 #endif 15 #endif
16 16
17 @interface ContentSuggestionsCoordinator ()<SuggestionsCommands> { 17 @interface ContentSuggestionsCoordinator ()<ContentSuggestionsCommands> {
18 UINavigationController* _navigationController; 18 UINavigationController* _navigationController;
19 } 19 }
20 20
21 @end 21 @end
22 22
23 @implementation ContentSuggestionsCoordinator 23 @implementation ContentSuggestionsCoordinator
24 24
25 @synthesize visible = _visible; 25 @synthesize visible = _visible;
26 26
27 - (void)start { 27 - (void)start {
28 if (self.visible) { 28 if (self.visible) {
29 // Prevent this coordinator from being started twice in a row. 29 // Prevent this coordinator from being started twice in a row.
30 return; 30 return;
31 } 31 }
32 32
33 _visible = YES; 33 _visible = YES;
34 34
35 SuggestionsViewController* suggestionsViewController = 35 ContentSuggestionsViewController* suggestionsViewController =
36 [[SuggestionsViewController alloc] 36 [[ContentSuggestionsViewController alloc]
37 initWithStyle:CollectionViewControllerStyleDefault]; 37 initWithStyle:CollectionViewControllerStyleDefault];
38 38
39 suggestionsViewController.suggestionCommandHandler = self; 39 suggestionsViewController.suggestionCommandHandler = self;
40 _navigationController = [[UINavigationController alloc] 40 _navigationController = [[UINavigationController alloc]
41 initWithRootViewController:suggestionsViewController]; 41 initWithRootViewController:suggestionsViewController];
42 42
43 suggestionsViewController.navigationItem.leftBarButtonItem = 43 suggestionsViewController.navigationItem.leftBarButtonItem =
44 [[UIBarButtonItem alloc] 44 [[UIBarButtonItem alloc]
45 initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE) 45 initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE)
46 style:UIBarButtonItemStylePlain 46 style:UIBarButtonItemStylePlain
47 target:self 47 target:self
48 action:@selector(stop)]; 48 action:@selector(stop)];
49 49
50 [self.baseViewController presentViewController:_navigationController 50 [self.baseViewController presentViewController:_navigationController
51 animated:YES 51 animated:YES
52 completion:nil]; 52 completion:nil];
53 } 53 }
54 54
55 - (void)stop { 55 - (void)stop {
56 [[_navigationController presentingViewController] 56 [[_navigationController presentingViewController]
57 dismissViewControllerAnimated:YES 57 dismissViewControllerAnimated:YES
58 completion:nil]; 58 completion:nil];
59 _navigationController = nil; 59 _navigationController = nil;
60 _visible = NO; 60 _visible = NO;
61 } 61 }
62 62
63 #pragma mark - SuggestionsCommands 63 #pragma mark - ContentSuggestionsCommands
64 64
65 - (void)openReadingList { 65 - (void)openReadingList {
66 } 66 }
67 67
68 - (void)openFirstPageOfReadingList { 68 - (void)openFirstPageOfReadingList {
69 } 69 }
70 70
71 - (void)addEmptyItem { 71 - (void)addEmptyItem {
72 } 72 }
73 73
74 - (void)openFaviconAtIndex:(NSInteger)index { 74 - (void)openFaviconAtIndex:(NSInteger)index {
75 } 75 }
76 76
77 @end 77 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698