| Index: components/rappor/rappor_service.h
|
| diff --git a/components/rappor/rappor_service.h b/components/rappor/rappor_service.h
|
| index d50b91e9ca2edda4878a7314e5344b94e16e6c7d..52a944eaa91f5255e8f95c50b8430df544a929d1 100644
|
| --- a/components/rappor/rappor_service.h
|
| +++ b/components/rappor/rappor_service.h
|
| @@ -14,6 +14,7 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/timer/timer.h"
|
| #include "components/metrics/daily_event.h"
|
| +#include "components/rappor/rappor_metric.h"
|
| #include "components/rappor/rappor_parameters.h"
|
|
|
| class PrefRegistrySimple;
|
| @@ -26,15 +27,25 @@ class URLRequestContextGetter;
|
| namespace rappor {
|
|
|
| class LogUploaderInterface;
|
| -class RapporMetric;
|
| class RapporReports;
|
|
|
| +namespace internal {
|
| +class RapporMetric;
|
| +}
|
| +
|
| // The type of data stored in a metric.
|
| enum RapporType {
|
| - // For sampling the eTLD+1 of a URL.
|
| - ETLD_PLUS_ONE_RAPPOR_TYPE = 0,
|
| - COARSE_RAPPOR_TYPE,
|
| - NUM_RAPPOR_TYPES
|
| + // For sampling strings, such as domain and registry.
|
| + UMA_STRING_RAPPOR_TYPE = 0,
|
| + // For sampling a string with some flag bits for correllation analysis.
|
| + UMA_STRING_AND_FLAGS_RAPPOR_TYPE,
|
| + // For safebrowsing controlled metrics.
|
| + SB_STRING_RAPPOR_TYPE,
|
| + SB_STRING_AND_FLAGS_RAPPOR_TYPE,
|
| + NUM_RAPPOR_TYPES,
|
| + // TODO(holte): Update callers and remove these aliases.
|
| + ETLD_PLUS_ONE_RAPPOR_TYPE = UMA_STRING_RAPPOR_TYPE,
|
| + COARSE_RAPPOR_TYPE = SB_STRING_RAPPOR_TYPE,
|
| };
|
|
|
| // This class provides an interface for recording samples for rappor metrics,
|
| @@ -69,6 +80,14 @@ class RapporService {
|
| RapporType type,
|
| const std::string& sample);
|
|
|
| + // Record a sample of the rappor metric specified by |metric_name|.
|
| + // Creates and initializes the metric, if it doesn't yet exist.
|
| + // This should be used for metric types that contain flag bytes.
|
| + void RecordStringAndFlags(const std::string& metric_name,
|
| + RapporType type,
|
| + const std::string& str,
|
| + uint64_t flags);
|
| +
|
| // Registers the names of all of the preferences used by RapporService in the
|
| // provided PrefRegistry. This should be called before calling Start().
|
| static void RegisterPrefs(PrefRegistrySimple* registry);
|
| @@ -99,7 +118,7 @@ class RapporService {
|
| // Exposed for tests.
|
| void RecordSampleInternal(const std::string& metric_name,
|
| const RapporParameters& parameters,
|
| - const std::string& sample);
|
| + const internal::Sample& sample);
|
|
|
| // Checks if the service has been started successfully.
|
| bool IsInitialized() const;
|
| @@ -110,8 +129,8 @@ class RapporService {
|
|
|
| // Finds a metric in the metrics_map_, creating it if it doesn't already
|
| // exist.
|
| - RapporMetric* LookUpMetric(const std::string& metric_name,
|
| - const RapporParameters& parameters);
|
| + internal::RapporMetric* LookUpMetric(const std::string& metric_name,
|
| + const RapporParameters& parameters);
|
|
|
| // A weak pointer to the PrefService used to read and write preferences.
|
| PrefService* pref_service_;
|
| @@ -139,7 +158,7 @@ class RapporService {
|
|
|
| // We keep all registered metrics in a map, from name to metric.
|
| // The map owns the metrics it contains.
|
| - std::map<std::string, RapporMetric*> metrics_map_;
|
| + std::map<std::string, internal::RapporMetric*> metrics_map_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(RapporService);
|
| };
|
|
|