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

Unified Diff: components/history/core/browser/url_utils.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
« no previous file with comments | « components/history/core/browser/url_utils.h ('k') | components/history/core/browser/url_utils_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/url_utils.cc
diff --git a/components/history/core/browser/url_utils.cc b/components/history/core/browser/url_utils.cc
index a993619be392f9d842a1a11a0647b0494dab4b54..73f25145a199cf8c06b96fb1f2c489c7eba7ff53 100644
--- a/components/history/core/browser/url_utils.cc
+++ b/components/history/core/browser/url_utils.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/strings/string_util.h"
#include "url/gurl.h"
namespace history {
@@ -85,4 +86,11 @@ GURL ToggleHTTPAndHTTPS(const GURL& url) {
return url.ReplaceComponents(replacement);
}
+std::string HostForTopHosts(const GURL& url) {
+ std::string host = url.host();
+ if (base::StartsWithASCII(host, "www.", true))
+ host.assign(host, 4, std::string::npos);
+ return host;
+}
+
} // namespace history
« no previous file with comments | « components/history/core/browser/url_utils.h ('k') | components/history/core/browser/url_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698