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

Side by Side Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2131133003: Add NewTabPage.TileType and .TileTypeClicked on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_race_condition
Patch Set: rebase Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "components/ntp_tiles/most_visited_sites.h" 5 #include "components/ntp_tiles/most_visited_sites.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } 227 }
228 228
229 void MostVisitedSites::RecordTileTypeMetrics( 229 void MostVisitedSites::RecordTileTypeMetrics(
230 const std::vector<int>& tile_types, 230 const std::vector<int>& tile_types,
231 const std::vector<int>& sources) { 231 const std::vector<int>& sources) {
232 int counts_per_type[NUM_TILE_TYPES] = {0}; 232 int counts_per_type[NUM_TILE_TYPES] = {0};
233 for (size_t i = 0; i < tile_types.size(); ++i) { 233 for (size_t i = 0; i < tile_types.size(); ++i) {
234 int tile_type = tile_types[i]; 234 int tile_type = tile_types[i];
235 ++counts_per_type[tile_type]; 235 ++counts_per_type[tile_type];
236
237 UMA_HISTOGRAM_ENUMERATION("NewTabPage.TileType", tile_type, NUM_TILE_TYPES);
238
236 std::string histogram = base::StringPrintf( 239 std::string histogram = base::StringPrintf(
237 "NewTabPage.TileType.%s", 240 "NewTabPage.TileType.%s",
238 GetSourceHistogramName(sources[i]).c_str()); 241 GetSourceHistogramName(sources[i]).c_str());
239 LogHistogramEvent(histogram, tile_type, NUM_TILE_TYPES); 242 LogHistogramEvent(histogram, tile_type, NUM_TILE_TYPES);
240 } 243 }
241 244
242 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsReal", 245 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsReal",
243 counts_per_type[ICON_REAL]); 246 counts_per_type[ICON_REAL]);
244 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsColor", 247 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsColor",
245 counts_per_type[ICON_COLOR]); 248 counts_per_type[ICON_COLOR]);
246 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsGray", 249 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsGray",
247 counts_per_type[ICON_DEFAULT]); 250 counts_per_type[ICON_DEFAULT]);
248 } 251 }
249 252
250 void MostVisitedSites::RecordOpenedMostVisitedItem(int index, 253 void MostVisitedSites::RecordOpenedMostVisitedItem(int index,
251 int tile_type, 254 int tile_type,
252 int source) { 255 int source) {
253 UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisited", index, num_sites_); 256 UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisited", index, num_sites_);
254 257
255 std::string histogram = base::StringPrintf( 258 std::string histogram = base::StringPrintf(
256 "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str()); 259 "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str());
257 LogHistogramEvent(histogram, index, num_sites_); 260 LogHistogramEvent(histogram, index, num_sites_);
258 261
262 UMA_HISTOGRAM_ENUMERATION(
263 "NewTabPage.TileTypeClicked", tile_type, NUM_TILE_TYPES);
264
259 histogram = base::StringPrintf("NewTabPage.TileTypeClicked.%s", 265 histogram = base::StringPrintf("NewTabPage.TileTypeClicked.%s",
260 GetSourceHistogramName(source).c_str()); 266 GetSourceHistogramName(source).c_str());
261 LogHistogramEvent(histogram, tile_type, NUM_TILE_TYPES); 267 LogHistogramEvent(histogram, tile_type, NUM_TILE_TYPES);
262 } 268 }
263 269
264 void MostVisitedSites::OnBlockedSitesChanged() { 270 void MostVisitedSites::OnBlockedSitesChanged() {
265 BuildCurrentSuggestions(); 271 BuildCurrentSuggestions();
266 } 272 }
267 273
268 // static 274 // static
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 549
544 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 550 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
545 ChangeReason change_reason) { 551 ChangeReason change_reason) {
546 if (mv_source_ == TOP_SITES) { 552 if (mv_source_ == TOP_SITES) {
547 // The displayed suggestions are invalidated. 553 // The displayed suggestions are invalidated.
548 InitiateTopSitesQuery(); 554 InitiateTopSitesQuery();
549 } 555 }
550 } 556 }
551 557
552 } // namespace ntp_tiles 558 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698