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

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

Issue 311133006: Add more Rappor metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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 | « chrome/browser/metrics/rappor/sampling.h ('k') | chrome/browser/metrics/rappor/sampling_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/rappor/sampling.cc
diff --git a/chrome/browser/metrics/rappor/sampling.cc b/chrome/browser/metrics/rappor/sampling.cc
new file mode 100644
index 0000000000000000000000000000000000000000..270d9742a52f49a302d623d0a66ac569a3174df9
--- /dev/null
+++ b/chrome/browser/metrics/rappor/sampling.cc
@@ -0,0 +1,35 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/metrics/rappor/sampling.h"
+
+#include "chrome/browser/browser_process.h"
+#include "components/rappor/rappor_service.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
+
+namespace rappor {
+
+void SampleDomainAndRegistryFromGURL(const std::string& metric,
+ const GURL& gurl) {
+ if (!g_browser_process->rappor_service())
+ return;
+ g_browser_process->rappor_service()->RecordSample(
+ metric,
+ rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
+ net::registry_controlled_domains::GetDomainAndRegistry(
+ gurl, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES));
+}
+
+void SampleDomainAndRegistryFromHost(const std::string& metric,
+ const std::string& host) {
+ if (!g_browser_process->rappor_service())
+ return;
+ g_browser_process->rappor_service()->RecordSample(
+ metric,
+ rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
+ net::registry_controlled_domains::GetDomainAndRegistry(
+ host, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES));
+}
+
+} // namespace rappor
« no previous file with comments | « chrome/browser/metrics/rappor/sampling.h ('k') | chrome/browser/metrics/rappor/sampling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698