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

Unified Diff: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm

Issue 2708623002: Add an ID to the ContentSuggestion (Closed)
Patch Set: Add tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/content_suggestions/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
index 6a6d4b1af726f4d494483b505f643fba4818a234..f7cb745a8e7015d63bd0e5d708ec78355c294393 100644
--- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
@@ -13,6 +13,7 @@
#import "ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper.h"
#import "ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h"
#include "ui/gfx/image/image.h"
@@ -52,13 +53,19 @@ ContentSuggestionsSectionLayout SectionLayoutForLayout(
ContentSuggestion* ConvertContentSuggestion(
const ntp_snippets::ContentSuggestion& contentSuggestion) {
ContentSuggestion* suggestion = [[ContentSuggestion alloc] init];
+
suggestion.title = base::SysUTF16ToNSString(contentSuggestion.title());
suggestion.text = base::SysUTF16ToNSString(contentSuggestion.snippet_text());
suggestion.url = contentSuggestion.url();
+
suggestion.publisher =
base::SysUTF16ToNSString(contentSuggestion.publisher_name());
suggestion.publishDate = contentSuggestion.publish_date();
+ suggestion.suggestionIdentifier = [[ContentSuggestionIdentifier alloc] init];
+ suggestion.suggestionIdentifier.IDInSection =
+ contentSuggestion.id().id_within_category();
+
return suggestion;
}
@@ -187,7 +194,8 @@ ContentSuggestionsSectionInformation* SectionInformationFromCategoryInfo(
for (auto& contentSuggestion : suggestions) {
ContentSuggestion* suggestion = ConvertContentSuggestion(contentSuggestion);
suggestion.type = TypeForCategory(category);
- suggestion.section = self.sectionInformationByCategory[categoryWrapper];
+ suggestion.suggestionIdentifier.sectionInfo =
+ self.sectionInformationByCategory[categoryWrapper];
// TODO(crbug.com/686728): fetch the image.
« no previous file with comments | « no previous file | ios/chrome/browser/ui/content_suggestions/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698