Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: components/rappor/rappor_prefs.cc

Issue 886523003: Add a Rappor option in the settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/rappor/rappor_pref_names.cc ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/rappor/rappor_prefs.h" 5 #include "components/rappor/rappor_prefs.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_registry_simple.h" 9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 20 matching lines...) Expand all
31 31
32 void RecordLoadSecretResult(LoadResult reason) { 32 void RecordLoadSecretResult(LoadResult reason) {
33 UMA_HISTOGRAM_ENUMERATION(kLoadSecretHistogramName, 33 UMA_HISTOGRAM_ENUMERATION(kLoadSecretHistogramName,
34 reason, 34 reason,
35 NUM_LOAD_RESULTS); 35 NUM_LOAD_RESULTS);
36 } 36 }
37 37
38 } // namespace 38 } // namespace
39 39
40 void RegisterPrefs(PrefRegistrySimple* registry) { 40 void RegisterPrefs(PrefRegistrySimple* registry) {
41 registry->RegisterBooleanPref(prefs::kRapporEnabled, true);
41 registry->RegisterStringPref(prefs::kRapporSecret, std::string()); 42 registry->RegisterStringPref(prefs::kRapporSecret, std::string());
42 registry->RegisterIntegerPref(prefs::kRapporCohortDeprecated, -1); 43 registry->RegisterIntegerPref(prefs::kRapporCohortDeprecated, -1);
43 registry->RegisterIntegerPref(prefs::kRapporCohortSeed, -1); 44 registry->RegisterIntegerPref(prefs::kRapporCohortSeed, -1);
44 metrics::DailyEvent::RegisterPref(registry, prefs::kRapporLastDailySample); 45 metrics::DailyEvent::RegisterPref(registry, prefs::kRapporLastDailySample);
45 } 46 }
46 47
47 int32_t LoadCohort(PrefService* pref_service) { 48 int32_t LoadCohort(PrefService* pref_service) {
48 // Ignore and delete old cohort parameter. 49 // Ignore and delete old cohort parameter.
49 pref_service->ClearPref(prefs::kRapporCohortDeprecated); 50 pref_service->ClearPref(prefs::kRapporCohortDeprecated);
50 51
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 DVLOG(2) << "Generated a new Rappor secret."; 90 DVLOG(2) << "Generated a new Rappor secret.";
90 secret = HmacByteVectorGenerator::GenerateEntropyInput(); 91 secret = HmacByteVectorGenerator::GenerateEntropyInput();
91 base::Base64Encode(secret, &secret_base64); 92 base::Base64Encode(secret, &secret_base64);
92 pref_service->SetString(prefs::kRapporSecret, secret_base64); 93 pref_service->SetString(prefs::kRapporSecret, secret_base64);
93 return secret; 94 return secret;
94 } 95 }
95 96
96 } // namespace internal 97 } // namespace internal
97 98
98 } // namespace rappor 99 } // namespace rappor
OLDNEW
« no previous file with comments | « components/rappor/rappor_pref_names.cc ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698