| OLD | NEW |
| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // If the newly generated ID is different than the previously stored one, then | 27 // If the newly generated ID is different than the previously stored one, then |
| 28 // the install is considered cloned. The ID is a 24-bit value based off of | 28 // the install is considered cloned. The ID is a 24-bit value based off of |
| 29 // machine characteristics. This value should never be sent over the network. | 29 // machine characteristics. This value should never be sent over the network. |
| 30 // TODO(jwd): Implement change detection. | 30 // TODO(jwd): Implement change detection. |
| 31 void CheckForClonedInstall(PrefService* local_state); | 31 void CheckForClonedInstall(PrefService* local_state); |
| 32 | 32 |
| 33 static void RegisterPrefs(PrefRegistrySimple* registry); | 33 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, SaveId); | 36 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, SaveId); |
| 37 FRIEND_TEST_ALL_PREFIXES(ClonedInstallDetectorTest, DetectClone); |
| 37 | 38 |
| 38 // Converts raw_id into a 24-bit hash and stores the hash in |local_state|. | 39 // Converts raw_id into a 24-bit hash and stores the hash in |local_state|. |
| 39 // |raw_id| is not a const ref because it's passed from a cross-thread post | 40 // |raw_id| is not a const ref because it's passed from a cross-thread post |
| 40 // task. | 41 // task. |
| 41 void SaveMachineId(PrefService* local_state, std::string raw_id); | 42 void SaveMachineId(PrefService* local_state, std::string raw_id); |
| 42 | 43 |
| 43 scoped_refptr<MachineIdProvider> raw_id_provider_; | 44 scoped_refptr<MachineIdProvider> raw_id_provider_; |
| 44 base::WeakPtrFactory<ClonedInstallDetector> weak_ptr_factory_; | 45 base::WeakPtrFactory<ClonedInstallDetector> weak_ptr_factory_; |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(ClonedInstallDetector); | 47 DISALLOW_COPY_AND_ASSIGN(ClonedInstallDetector); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace metrics | 50 } // namespace metrics |
| 50 | 51 |
| 51 #endif // CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_ | 52 #endif // CHROME_BROWSER_METRICS_CLONED_INSTALL_DETECTOR_H_ |
| OLD | NEW |