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

Side by Side Diff: chrome/browser/metrics/cloned_install_detector.h

Issue 292723004: Remove ClonedInstallDetector/MachineIdProvider //content dependencies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 6 years, 7 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_ 5 #ifndef CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_
6 #define CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_ 6 #define CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 11
12 class PrefRegistrySimple; 12 class PrefRegistrySimple;
13 class PrefService; 13 class PrefService;
14 14
15 namespace base {
16 class SingleThreadTaskRunner;
17 }
18
15 namespace metrics { 19 namespace metrics {
16 20
17 class MachineIdProvider; 21 class MachineIdProvider;
18 22
19 // A class for detecting if an install is cloned. It does this by detecting 23 // A class for detecting if an install is cloned. It does this by detecting
20 // when the hardware running Chrome changes. 24 // when the hardware running Chrome changes.
21 class ClonedInstallDetector { 25 class ClonedInstallDetector {
22 public: 26 public:
23 explicit ClonedInstallDetector(MachineIdProvider* raw_id_provider); 27 explicit ClonedInstallDetector(MachineIdProvider* raw_id_provider);
24 virtual ~ClonedInstallDetector(); 28 virtual ~ClonedInstallDetector();
25 29
26 // Posts a task to generate a machine ID and store it to a local state pref. 30 // Posts a task to |task_runner| to generate a machine ID and store it to a
27 // If the newly generated ID is different than the previously stored one, then 31 // local state pref. If the newly generated ID is different than the
28 // the install is considered cloned. The ID is a 24-bit value based off of 32 // previously stored one, then the install is considered cloned. The ID is a
29 // machine characteristics. This value should never be sent over the network. 33 // 24-bit value based off of machine characteristics. This value should never
34 // be sent over the network.
30 // TODO(jwd): Implement change detection. 35 // TODO(jwd): Implement change detection.
31 void CheckForClonedInstall(PrefService* local_state); 36 void CheckForClonedInstall(
37 PrefService* local_state,
38 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
32 39
33 static void RegisterPrefs(PrefRegistrySimple* registry); 40 static void RegisterPrefs(PrefRegistrySimple* registry);
34 41
35 private: 42 private:
36 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, SaveId); 43 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, SaveId);
37 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, DetectClone); 44 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, DetectClone);
38 45
39 // Converts raw_id into a 24-bit hash and stores the hash in |local_state|. 46 // Converts raw_id into a 24-bit hash and stores the hash in |local_state|.
40 // |raw_id| is not a const ref because it's passed from a cross-thread post 47 // |raw_id| is not a const ref because it's passed from a cross-thread post
41 // task. 48 // task.
42 void SaveMachineId(PrefService* local_state, std::string raw_id); 49 void SaveMachineId(PrefService* local_state, std::string raw_id);
43 50
44 scoped_refptr<MachineIdProvider> raw_id_provider_; 51 scoped_refptr<MachineIdProvider> raw_id_provider_;
45 base::WeakPtrFactory<ClonedInstallDetector> weak_ptr_factory_; 52 base::WeakPtrFactory<ClonedInstallDetector> weak_ptr_factory_;
46 53
47 DISALLOW_COPY_AND_ASSIGN(ClonedInstallDetector); 54 DISALLOW_COPY_AND_ASSIGN(ClonedInstallDetector);
48 }; 55 };
49 56
50 } // namespace metrics 57 } // namespace metrics
51 58
52 #endif // CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_ 59 #endif // CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/metrics/cloned_install_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698