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

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

Issue 2888533002: Identify MostVisited by item instead of URL (Closed)
Patch Set: Address comments Created 3 years, 7 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/mediator_util.h" 5 #import "ios/chrome/browser/content_suggestions/mediator_util.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "components/ntp_snippets/category.h" 8 #include "components/ntp_snippets/category.h"
9 #include "components/ntp_tiles/metrics.h" 9 #include "components/ntp_tiles/metrics.h"
10 #include "components/rappor/rappor_service_impl.h" 10 #include "components/rappor/rappor_service_impl.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void RecordPageImpression(const ntp_tiles::NTPTilesVector& mostVisited) { 115 void RecordPageImpression(const ntp_tiles::NTPTilesVector& mostVisited) {
116 std::vector<ntp_tiles::metrics::TileImpression> tiles; 116 std::vector<ntp_tiles::metrics::TileImpression> tiles;
117 for (const ntp_tiles::NTPTile& ntpTile : mostVisited) { 117 for (const ntp_tiles::NTPTile& ntpTile : mostVisited) {
118 tiles.emplace_back(ntpTile.source, ntp_tiles::UNKNOWN_TILE_TYPE, 118 tiles.emplace_back(ntpTile.source, ntp_tiles::UNKNOWN_TILE_TYPE,
119 ntpTile.url); 119 ntpTile.url);
120 } 120 }
121 ntp_tiles::metrics::RecordPageImpression( 121 ntp_tiles::metrics::RecordPageImpression(
122 tiles, GetApplicationContext()->GetRapporServiceImpl()); 122 tiles, GetApplicationContext()->GetRapporServiceImpl());
123 } 123 }
124 124
125 CollectionViewItem<SuggestedContent>* ConvertNTPTile( 125 ContentSuggestionsMostVisitedItem* ConvertNTPTile(
126 const ntp_tiles::NTPTile& tile, 126 const ntp_tiles::NTPTile& tile,
127 ContentSuggestionsSectionInformation* sectionInfo) { 127 ContentSuggestionsSectionInformation* sectionInfo) {
128 ContentSuggestionsMostVisitedItem* suggestion = 128 ContentSuggestionsMostVisitedItem* suggestion =
129 [[ContentSuggestionsMostVisitedItem alloc] initWithType:0]; 129 [[ContentSuggestionsMostVisitedItem alloc] initWithType:0];
130 130
131 suggestion.title = base::SysUTF16ToNSString(tile.title); 131 suggestion.title = base::SysUTF16ToNSString(tile.title);
132 suggestion.URL = tile.url; 132 suggestion.URL = tile.url;
133 133
134 suggestion.suggestionIdentifier = [[ContentSuggestionIdentifier alloc] init]; 134 suggestion.suggestionIdentifier = [[ContentSuggestionIdentifier alloc] init];
135 suggestion.suggestionIdentifier.IDInSection = tile.url.spec(); 135 suggestion.suggestionIdentifier.IDInSection = tile.url.spec();
136 suggestion.suggestionIdentifier.sectionInfo = sectionInfo; 136 suggestion.suggestionIdentifier.sectionInfo = sectionInfo;
137 137
138 return suggestion; 138 return suggestion;
139 } 139 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/content_suggestions/mediator_util.h ('k') | ios/chrome/browser/ui/content_suggestions/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698