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

Unified Diff: components/history/core/browser/history_database.cc

Issue 1179953005: Add History.TopHostsVisitsByRank UMA metric. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@is_allowed
Patch Set: Use HistogramTester to eliminate test brittleness. Created 5 years, 6 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
Index: components/history/core/browser/history_database.cc
diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc
index 888a30a80c30b9e32b842beac7c24d97c23b3ca9..0966d9387716e538a3717655b64c4c77872ca703 100644
--- a/components/history/core/browser/history_database.cc
+++ b/components/history/core/browser/history_database.cc
@@ -18,6 +18,7 @@
#include "base/rand_util.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
+#include "components/history/core/browser/url_utils.h"
#include "sql/statement.h"
#include "sql/transaction.h"
@@ -208,10 +209,7 @@ TopHostsList HistoryDatabase::TopHosts(int num_hosts) {
continue;
int64 visit_count = url_sql.ColumnInt64(1);
- std::string host = url.host();
- if (base::StartsWithASCII(host, "www.", true))
- host.assign(host, 4, std::string::npos);
- host_count[host] += visit_count;
+ host_count[HostForTopHosts(url)] += visit_count;
// kMaxHostsInMemory is well above typical values for
// History.MonthlyHostCount, but here to guard against unbounded memory
« no previous file with comments | « components/history/core/browser/history_backend_unittest.cc ('k') | components/history/core/browser/url_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698