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

Side by Side Diff: components/metrics/cloned_install_detector.cc

Issue 1662843002: Revert of Delete base/prefs and update callers to use components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/metrics/cloned_install_detector.h" 5 #include "components/metrics/cloned_install_detector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/metrics/metrics_hashes.h" 14 #include "base/metrics/metrics_hashes.h"
15 #include "base/prefs/pref_registry_simple.h"
16 #include "base/prefs/pref_service.h"
15 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
16 #include "base/task_runner_util.h" 18 #include "base/task_runner_util.h"
17 #include "components/metrics/machine_id_provider.h" 19 #include "components/metrics/machine_id_provider.h"
18 #include "components/metrics/metrics_pref_names.h" 20 #include "components/metrics/metrics_pref_names.h"
19 #include "components/prefs/pref_registry_simple.h"
20 #include "components/prefs/pref_service.h"
21 21
22 namespace metrics { 22 namespace metrics {
23 23
24 namespace { 24 namespace {
25 25
26 uint32_t HashRawId(const std::string& value) { 26 uint32_t HashRawId(const std::string& value) {
27 uint64_t hash = base::HashMetricName(value); 27 uint64_t hash = base::HashMetricName(value);
28 28
29 // Only use 24 bits from the 64-bit hash. 29 // Only use 24 bits from the 64-bit hash.
30 return hash & ((1 << 24) - 1); 30 return hash & ((1 << 24) - 1);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 local_state->SetInteger(prefs::kMetricsMachineId, hashed_id); 93 local_state->SetInteger(prefs::kMetricsMachineId, hashed_id);
94 } 94 }
95 95
96 // static 96 // static
97 void ClonedInstallDetector::RegisterPrefs(PrefRegistrySimple* registry) { 97 void ClonedInstallDetector::RegisterPrefs(PrefRegistrySimple* registry) {
98 registry->RegisterIntegerPref(prefs::kMetricsMachineId, 0); 98 registry->RegisterIntegerPref(prefs::kMetricsMachineId, 0);
99 } 99 }
100 100
101 } // namespace metrics 101 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/clean_exit_beacon.cc ('k') | components/metrics/cloned_install_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698