• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_METRICS_ENABLED_STATE_PROVIDER_H_
6 #define COMPONENTS_METRICS_ENABLED_STATE_PROVIDER_H_
7 
8 namespace metrics {
9 
10 // An interface that provides whether metrics should be reported.
11 class EnabledStateProvider {
12  public:
13   virtual ~EnabledStateProvider() = default;
14 
15   // Indicates that the user has provided consent to collect and report metrics.
16   virtual bool IsConsentGiven() const = 0;
17 
18   // Should collection and reporting be enabled. This should depend on consent
19   // being given.
20   virtual bool IsReportingEnabled() const;
21 
22   // Enable or disable checking whether field trials are forced or not at
23   // EnabledStateProvider::IsReportingEnabled().
24   static void SetIgnoreForceFieldTrialsForTesting(bool ignore_trials);
25 };
26 
27 }  // namespace metrics
28 
29 #endif  // COMPONENTS_METRICS_ENABLED_STATE_PROVIDER_H_
30