1 // Copyright 2015 The Chromium Authors. All rights reserved.
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_RAPPOR_RAPPOR_PREFS_H_
6 #define COMPONENTS_RAPPOR_RAPPOR_PREFS_H_
7 
8 #include <stdint.h>
9 
10 #include <string>
11 
12 
13 class PrefService;
14 class PrefRegistrySimple;
15 
16 namespace rappor {
17 
18 namespace internal {
19 
20 enum LoadResult {
21   LOAD_SUCCESS = 0,
22   LOAD_EMPTY_VALUE,
23   LOAD_CORRUPT_VALUE,
24   NUM_LOAD_RESULTS,
25 };
26 
27 extern const char kLoadCohortHistogramName[];
28 extern const char kLoadSecretHistogramName[];
29 
30 // Registers all rappor preferences.
31 void RegisterPrefs(PrefRegistrySimple* registry);
32 
33 // Retrieves the cohort number this client was assigned to, generating it if
34 // doesn't already exist. The cohort should be persistent.
35 int32_t LoadCohort(PrefService* pref_service);
36 
37 // Retrieves the value for secret from preferences, generating it if doesn't
38 // already exist. The secret should be persistent, so that additional bits
39 // from the client do not get exposed over time.
40 std::string LoadSecret(PrefService* pref_service);
41 
42 }  // namespace internal
43 
44 }  // namespace rappor
45 
46 #endif  // COMPONENTS_RAPPOR_RAPPOR_PREFS_H_
47