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

Side by Side Diff: ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm

Issue 2697573002: Modify article item in ContentSuggestions (Closed)
Patch Set: Cleanup 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/content_suggestions/content_suggestions_collectio n_updater.h" 5 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collectio n_updater.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/foundation_util.h" 8 #include "base/mac/foundation_util.h"
9 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h" 9 #import "ios/chrome/browser/ui/collection_view/collection_view_controller.h"
10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" 10 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
11 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i tem.h" 11 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_i tem.h"
12 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink .h" 12 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink .h"
13 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sour ce.h" 13 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sour ce.h"
14 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_expandabl e_item.h" 14 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_expandabl e_item.h"
15 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_i tem.h" 15 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_i tem.h"
16 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_item.h" 16 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_item.h"
17 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_stack_ite m.h" 17 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_stack_ite m.h"
18 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h" 18 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont roller.h"
19 #include "url/gurl.h"
19 20
20 #if !defined(__has_feature) || !__has_feature(objc_arc) 21 #if !defined(__has_feature) || !__has_feature(objc_arc)
21 #error "This file requires ARC support." 22 #error "This file requires ARC support."
22 #endif 23 #endif
23 24
24 @interface ContentSuggestionsCollectionUpdater ()<ContentSuggestionsDataSink> 25 @interface ContentSuggestionsCollectionUpdater ()<ContentSuggestionsDataSink>
25 26
26 @property(nonatomic, weak) id<ContentSuggestionsDataSource> dataSource; 27 @property(nonatomic, weak) id<ContentSuggestionsDataSource> dataSource;
27 28
28 @end 29 @end
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 initWithType:ItemTypeStack 62 initWithType:ItemTypeStack
62 title:@"The title" 63 title:@"The title"
63 subtitle:@"The subtitle"] 64 subtitle:@"The subtitle"]
64 toSectionWithIdentifier:sectionIdentifier++]; 65 toSectionWithIdentifier:sectionIdentifier++];
65 66
66 // Favicon Item. 67 // Favicon Item.
67 [model addSectionWithIdentifier:sectionIdentifier]; 68 [model addSectionWithIdentifier:sectionIdentifier];
68 ContentSuggestionsFaviconItem* faviconItem = 69 ContentSuggestionsFaviconItem* faviconItem =
69 [[ContentSuggestionsFaviconItem alloc] initWithType:ItemTypeFavicon]; 70 [[ContentSuggestionsFaviconItem alloc] initWithType:ItemTypeFavicon];
70 for (NSInteger i = 0; i < 6; i++) { 71 for (NSInteger i = 0; i < 6; i++) {
71 [faviconItem addFavicon:[UIImage imageNamed:@"bookmark_gray_star"] 72 [faviconItem addFavicon:[UIImage imageNamed:@"bookmark_gray_star_large"]
lpromero 2017/02/13 13:42:40 Is the bookmark_gray_star image still used anywher
gambard 2017/02/13 14:32:02 It has been removed. This is used to display somet
72 withTitle:@"Super website! Incredible!"]; 73 withTitle:@"Super website! Incredible!"];
73 } 74 }
74 faviconItem.delegate = _collectionViewController; 75 faviconItem.delegate = _collectionViewController;
75 [model addItem:faviconItem toSectionWithIdentifier:sectionIdentifier++]; 76 [model addItem:faviconItem toSectionWithIdentifier:sectionIdentifier++];
76 77
77 for (NSInteger i = 0; i < 3; i++) { 78 for (NSInteger i = 0; i < 3; i++) {
78 [model addSectionWithIdentifier:sectionIdentifier]; 79 [model addSectionWithIdentifier:sectionIdentifier];
79 80
80 // Standard Item. 81 // Standard Item.
81 [model addItem:[[ContentSuggestionsItem alloc] initWithType:ItemTypeText 82 [model addItem:[[ContentSuggestionsItem alloc] initWithType:ItemTypeText
82 title:@"The title" 83 title:@"The title"
83 subtitle:@"The subtitle"] 84 subtitle:@"The subtitle"]
84 toSectionWithIdentifier:sectionIdentifier]; 85 toSectionWithIdentifier:sectionIdentifier];
85 86
86 // Article Item. 87 // Article Item.
87 [model addItem:[[ContentSuggestionsArticleItem alloc] 88 [model addItem:[[ContentSuggestionsArticleItem alloc]
88 initWithType:ItemTypeArticle 89 initWithType:ItemTypeArticle
89 title:@"Title of an Article" 90 title:@"Title of an Article"
90 subtitle:@"This is the subtitle of an article, can " 91 subtitle:@"This is the subtitle of an article, can "
91 @"spawn on multiple lines" 92 @"spawn on multiple lines"
92 image:[UIImage 93 image:[UIImage imageNamed:@"distillation_success"]
93 imageNamed:@"distillation_success"]] 94 url:GURL()]
94 toSectionWithIdentifier:sectionIdentifier]; 95 toSectionWithIdentifier:sectionIdentifier];
95 96
96 // Expandable Item. 97 // Expandable Item.
97 SuggestionsExpandableItem* expandableItem = 98 SuggestionsExpandableItem* expandableItem =
98 [[SuggestionsExpandableItem alloc] 99 [[SuggestionsExpandableItem alloc]
99 initWithType:ItemTypeExpand 100 initWithType:ItemTypeExpand
100 title:@"Title of an Expandable Article" 101 title:@"Title of an Expandable Article"
101 subtitle:@"This Article can be expanded to display " 102 subtitle:@"This Article can be expanded to display "
102 @"additional information or interaction " 103 @"additional information or interaction "
103 @"options" 104 @"options"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 inSection:sectionIndex] ]]; 153 inSection:sectionIndex] ]];
153 } 154 }
154 completion:nil]; 155 completion:nil];
155 } 156 }
156 157
157 - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section { 158 - (BOOL)shouldUseCustomStyleForSection:(NSInteger)section {
158 return section == 0 || section == 1; 159 return section == 0 || section == 1;
159 } 160 }
160 161
161 @end 162 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698