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_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 6 #define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); | 48 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); |
49 | 49 |
50 // Returns the serial number of the last loaded or stored seed. | 50 // Returns the serial number of the last loaded or stored seed. |
51 const std::string& variations_serial_number() const { | 51 const std::string& variations_serial_number() const { |
52 return variations_serial_number_; | 52 return variations_serial_number_; |
53 } | 53 } |
54 | 54 |
55 // Registers Local State prefs used by this class. | 55 // Registers Local State prefs used by this class. |
56 static void RegisterPrefs(PrefRegistrySimple* registry); | 56 static void RegisterPrefs(PrefRegistrySimple* registry); |
57 | 57 |
58 // Returns the invalid signature in base64 format, or an empty string if the | |
59 // signature was valid, missing, or if signature verification is disabled. | |
60 std::string GetInvalidSignature() const; | |
61 | |
62 protected: | 58 protected: |
63 // Note: UMA histogram enum - don't re-order or remove entries. | 59 // Note: UMA histogram enum - don't re-order or remove entries. |
64 enum VerifySignatureResult { | 60 enum VerifySignatureResult { |
65 VARIATIONS_SEED_SIGNATURE_MISSING, | 61 VARIATIONS_SEED_SIGNATURE_MISSING, |
66 VARIATIONS_SEED_SIGNATURE_DECODE_FAILED, | 62 VARIATIONS_SEED_SIGNATURE_DECODE_FAILED, |
67 VARIATIONS_SEED_SIGNATURE_INVALID_SIGNATURE, | 63 VARIATIONS_SEED_SIGNATURE_INVALID_SIGNATURE, |
68 VARIATIONS_SEED_SIGNATURE_INVALID_SEED, | 64 VARIATIONS_SEED_SIGNATURE_INVALID_SEED, |
69 VARIATIONS_SEED_SIGNATURE_VALID, | 65 VARIATIONS_SEED_SIGNATURE_VALID, |
70 VARIATIONS_SEED_SIGNATURE_ENUM_SIZE, | 66 VARIATIONS_SEED_SIGNATURE_ENUM_SIZE, |
71 }; | 67 }; |
(...skipping 13 matching lines...) Expand all Loading... |
85 | 81 |
86 // Clears all prefs related to variations seed storage. | 82 // Clears all prefs related to variations seed storage. |
87 void ClearPrefs(); | 83 void ClearPrefs(); |
88 | 84 |
89 // The pref service used to persist the variations seed. | 85 // The pref service used to persist the variations seed. |
90 PrefService* local_state_; | 86 PrefService* local_state_; |
91 | 87 |
92 // Cached serial number from the most recently fetched variations seed. | 88 // Cached serial number from the most recently fetched variations seed. |
93 std::string variations_serial_number_; | 89 std::string variations_serial_number_; |
94 | 90 |
95 // Keeps track of an invalid signature. | |
96 std::string invalid_base64_signature_; | |
97 | |
98 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); | 91 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); |
99 }; | 92 }; |
100 | 93 |
101 } // namespace chrome_variations | 94 } // namespace chrome_variations |
102 | 95 |
103 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 96 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
OLD | NEW |