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 COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 5 #ifndef COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 6 #define COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
13 | 14 |
14 class PrefService; | 15 class PrefService; |
15 class PrefRegistrySimple; | 16 class PrefRegistrySimple; |
16 | 17 |
17 namespace variations { | 18 namespace variations { |
18 class VariationsSeed; | 19 class VariationsSeed; |
19 } | 20 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return seed_has_country_code_; | 69 return seed_has_country_code_; |
69 } | 70 } |
70 | 71 |
71 // Returns the invalid signature in base64 format, or an empty string if the | 72 // Returns the invalid signature in base64 format, or an empty string if the |
72 // signature was valid, missing, or if signature verification is disabled. | 73 // signature was valid, missing, or if signature verification is disabled. |
73 std::string GetInvalidSignature() const; | 74 std::string GetInvalidSignature() const; |
74 | 75 |
75 // Registers Local State prefs used by this class. | 76 // Registers Local State prefs used by this class. |
76 static void RegisterPrefs(PrefRegistrySimple* registry); | 77 static void RegisterPrefs(PrefRegistrySimple* registry); |
77 | 78 |
| 79 #if defined(OS_ANDROID) |
| 80 void SetPullVariationsSeedCallback( |
| 81 const base::Callback<std::string(const std::string&)>& callback) { |
| 82 pull_variations_seed_pref_ = callback; |
| 83 } |
| 84 #endif // OS_ANDROID |
| 85 |
78 protected: | 86 protected: |
79 // Note: UMA histogram enum - don't re-order or remove entries. | 87 // Note: UMA histogram enum - don't re-order or remove entries. |
80 enum VerifySignatureResult { | 88 enum VerifySignatureResult { |
81 VARIATIONS_SEED_SIGNATURE_MISSING, | 89 VARIATIONS_SEED_SIGNATURE_MISSING, |
82 VARIATIONS_SEED_SIGNATURE_DECODE_FAILED, | 90 VARIATIONS_SEED_SIGNATURE_DECODE_FAILED, |
83 VARIATIONS_SEED_SIGNATURE_INVALID_SIGNATURE, | 91 VARIATIONS_SEED_SIGNATURE_INVALID_SIGNATURE, |
84 VARIATIONS_SEED_SIGNATURE_INVALID_SEED, | 92 VARIATIONS_SEED_SIGNATURE_INVALID_SEED, |
85 VARIATIONS_SEED_SIGNATURE_VALID, | 93 VARIATIONS_SEED_SIGNATURE_VALID, |
86 VARIATIONS_SEED_SIGNATURE_ENUM_SIZE, | 94 VARIATIONS_SEED_SIGNATURE_ENUM_SIZE, |
87 }; | 95 }; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Cached serial number from the most recently fetched variations seed. | 135 // Cached serial number from the most recently fetched variations seed. |
128 std::string variations_serial_number_; | 136 std::string variations_serial_number_; |
129 | 137 |
130 // Whether the most recently fetched variations seed has the country code | 138 // Whether the most recently fetched variations seed has the country code |
131 // field set. | 139 // field set. |
132 bool seed_has_country_code_; | 140 bool seed_has_country_code_; |
133 | 141 |
134 // Keeps track of an invalid signature. | 142 // Keeps track of an invalid signature. |
135 std::string invalid_base64_signature_; | 143 std::string invalid_base64_signature_; |
136 | 144 |
| 145 base::Callback<std::string(const std::string&)> pull_variations_seed_pref_; |
| 146 |
137 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); | 147 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); |
138 }; | 148 }; |
139 | 149 |
140 } // namespace variations | 150 } // namespace variations |
141 | 151 |
142 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 152 #endif // COMPONENTS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
OLD | NEW |