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_METRICS_REPORTING_DEFAULT_STATE_H_ 6 #define COMPONENTS_METRICS_METRICS_REPORTING_DEFAULT_STATE_H_ 7 8 class PrefRegistrySimple; 9 class PrefService; 10 11 namespace metrics { 12 13 // Metrics reporting default state. This relates to the state of the enable 14 // checkbox shown on first-run. This enum is used to store values in a pref, and 15 // shouldn't be renumbered. 16 enum EnableMetricsDefault { 17 // We only record the value during first-run. The default of existing 18 // installs is considered unknown. 19 DEFAULT_UNKNOWN, 20 // The first-run checkbox was unchecked by default. 21 OPT_IN, 22 // The first-run checkbox was checked by default. 23 OPT_OUT, 24 }; 25 26 // Register prefs relating to metrics reporting state. Currently only registers 27 // a pref for metrics reporting default opt-in state. 28 void RegisterMetricsReportingStatePrefs(PrefRegistrySimple* registry); 29 30 // Sets whether metrics reporting was opt-in or not. If it was opt-in, then the 31 // enable checkbox on first-run was default unchecked. If it was opt-out, then 32 // the checkbox was default checked. This should only be set once, and only 33 // during first-run. 34 void RecordMetricsReportingDefaultState(PrefService* local_state, 35 EnableMetricsDefault default_state); 36 37 // Same as above, but does not verify the current state is UNKNOWN. 38 void ForceRecordMetricsReportingDefaultState( 39 PrefService* local_state, 40 EnableMetricsDefault default_state); 41 42 // Gets information about the default value for the enable metrics reporting 43 // checkbox shown during first-run. 44 EnableMetricsDefault GetMetricsReportingDefaultState(PrefService* local_state); 45 46 } // namespace metrics 47 48 #endif // COMPONENTS_METRICS_METRICS_REPORTING_DEFAULT_STATE_H_ 49