| Index: components/rappor/rappor_service.cc
|
| diff --git a/components/rappor/rappor_service.cc b/components/rappor/rappor_service.cc
|
| index 7fc4fce7fb4e86f94b330d1e6a94df7927960137..c78ed207cc88c103e88441b6e85b2d3de692ba1d 100644
|
| --- a/components/rappor/rappor_service.cc
|
| +++ b/components/rappor/rappor_service.cc
|
| @@ -5,6 +5,7 @@
|
| #include "components/rappor/rappor_service.h"
|
|
|
| #include "base/metrics/field_trial.h"
|
| +#include "base/metrics/user_metrics.h"
|
| #include "base/stl_util.h"
|
| #include "base/time/time.h"
|
| #include "components/metrics/metrics_hashes.h"
|
| @@ -105,6 +106,8 @@ void RapporService::Initialize(net::URLRequestContextGetter* request_context) {
|
| request_context)),
|
| internal::LoadCohort(pref_service_),
|
| internal::LoadSecret(pref_service_));
|
| +
|
| + EnableRecordFromUserMetrics();
|
| }
|
|
|
| void RapporService::Update(RecordingLevel recording_level, bool may_upload) {
|
| @@ -183,6 +186,18 @@ void RapporService::OnLogInterval() {
|
| ScheduleNextLogRotation(base::TimeDelta::FromSeconds(kLogIntervalSeconds));
|
| }
|
|
|
| +void RapporService::EnableRecordFromUserMetrics() {
|
| + user_metrics_callback_ = base::Bind(&RapporService::OnUserMetricsCallback,
|
| + base::Unretained(this));
|
| + base::AddRapporCallback(user_metrics_callback_);
|
| +}
|
| +
|
| +void RapporService::OnUserMetricsCallback(
|
| + const std::string& metric,
|
| + const std::string& sample) {
|
| + RecordSample(metric, ETLD_PLUS_ONE_RAPPOR_TYPE, sample);
|
| +}
|
| +
|
| bool RapporService::ExportMetrics(RapporReports* reports) {
|
| if (metrics_map_.empty()) {
|
| DVLOG(2) << "metrics_map_ is empty.";
|
|
|