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

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

Issue 2429283003: Desktop NTP metrics: Use ntp_tiles::metrics:: functions (Closed)
Patch Set: review Created 4 years, 1 month 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 | « components/ntp_tiles/metrics.cc ('k') | 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 <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 std::move(whitelist_tiles.begin(), whitelist_tiles.end(), 391 std::move(whitelist_tiles.begin(), whitelist_tiles.end(),
392 std::back_inserter(merged_tiles)); 392 std::back_inserter(merged_tiles));
393 std::move(popular_tiles.begin(), popular_tiles.end(), 393 std::move(popular_tiles.begin(), popular_tiles.end(),
394 std::back_inserter(merged_tiles)); 394 std::back_inserter(merged_tiles));
395 return merged_tiles; 395 return merged_tiles;
396 } 396 }
397 397
398 void MostVisitedSites::NotifyMostVisitedURLsObserver() { 398 void MostVisitedSites::NotifyMostVisitedURLsObserver() {
399 if (!waiting_for_most_visited_sites_ && !waiting_for_popular_sites_ && 399 if (!waiting_for_most_visited_sites_ && !waiting_for_popular_sites_ &&
400 !recorded_impressions_) { 400 !recorded_impressions_) {
401 metrics::RecordImpressions(current_tiles_); 401 // TODO(treib): Move this out of here. crbug.com/514752
402 int num_tiles = static_cast<int>(current_tiles_.size());
403 for (int i = 0; i < num_tiles; i++)
404 metrics::RecordTileImpression(i, current_tiles_[i].source);
405 metrics::RecordPageImpression(num_tiles);
402 recorded_impressions_ = true; 406 recorded_impressions_ = true;
403 } 407 }
404 408
405 if (!observer_) 409 if (!observer_)
406 return; 410 return;
407 411
408 observer_->OnMostVisitedURLsAvailable(current_tiles_); 412 observer_->OnMostVisitedURLsAvailable(current_tiles_);
409 } 413 }
410 414
411 void MostVisitedSites::OnPopularSitesAvailable(bool success) { 415 void MostVisitedSites::OnPopularSitesAvailable(bool success) {
(...skipping 18 matching lines...) Expand all
430 434
431 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 435 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
432 ChangeReason change_reason) { 436 ChangeReason change_reason) {
433 if (mv_source_ == NTPTileSource::TOP_SITES) { 437 if (mv_source_ == NTPTileSource::TOP_SITES) {
434 // The displayed tiles are invalidated. 438 // The displayed tiles are invalidated.
435 InitiateTopSitesQuery(); 439 InitiateTopSitesQuery();
436 } 440 }
437 } 441 }
438 442
439 } // namespace ntp_tiles 443 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « components/ntp_tiles/metrics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698