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

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..2aed58b5b229562cc16d70185d079d490359b419 100644
--- a/chrome/browser/metrics/rappor/sampling.cc
+++ b/chrome/browser/metrics/rappor/sampling.cc
@@ -6,12 +6,19 @@
#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"
namespace rappor {
std::string GetDomainAndRegistrySampleFromGURL(const GURL& gurl) {
+ if (net::IsLocalhost(gurl.host())) {
Alexei Svitkine (slow) 2015/02/18 21:22:20 Nit: No {}'s. Same below.
Steven Holte 2015/02/19 23:42:19 Done.
+ return "localhost";
Nathan Parker 2015/02/18 21:56:46 I think this should go inside the if IsHTTPorHTTPS
Steven Holte 2015/02/19 23:42:19 Done.
+ }
+ if (gurl.HostIsIPAddress()) {
+ return "ip_address";
+ }
if (gurl.SchemeIsHTTPOrHTTPS()) {
return net::registry_controlled_domains::GetDomainAndRegistry(
gurl, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);

Powered by Google App Engine
This is Rietveld 408576698