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

Unified Diff: chrome/browser/metrics/rappor/sampling.cc

Issue 933853003: Identify localhost/ipaddress in RapporSamples (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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: chrome/browser/metrics/rappor/sampling.cc
diff --git a/chrome/browser/metrics/rappor/sampling.cc b/chrome/browser/metrics/rappor/sampling.cc
index d5c01b3d3dcb8499c01d6e8c4826ec54172835b4..1000098ec635b3fe51556a4a12e285a4741341a0 100644
--- a/chrome/browser/metrics/rappor/sampling.cc
+++ b/chrome/browser/metrics/rappor/sampling.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/browser_process.h"
#include "components/rappor/rappor_service.h"
+#include "net/base/net_util.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "url/gurl.h"
@@ -13,6 +14,10 @@ namespace rappor {
std::string GetDomainAndRegistrySampleFromGURL(const GURL& gurl) {
if (gurl.SchemeIsHTTPOrHTTPS()) {
+ if (net::IsLocalhost(gurl.host()))
+ return "localhost";
+ if (gurl.HostIsIPAddress())
+ return "ip_address";
Nathan Parker 2015/02/20 18:47:04 Will the Rappor backend match against these string
Steven Holte 2015/02/20 19:47:11 Yes, I'll just add these to the list of strings we
return net::registry_controlled_domains::GetDomainAndRegistry(
gurl, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
}

Powered by Google App Engine
This is Rietveld 408576698