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 15 matching lines...) Expand all Loading... |
26 virtual ~VariationsSeedStore(); | 26 virtual ~VariationsSeedStore(); |
27 | 27 |
28 // Loads the variations seed data from local state into |seed|. If there is a | 28 // Loads the variations seed data from local state into |seed|. If there is a |
29 // problem with loading, the pref value is cleared and false is returned. If | 29 // problem with loading, the pref value is cleared and false is returned. If |
30 // successful, |seed| will contain the loaded data and true is returned. | 30 // successful, |seed| will contain the loaded data and true is returned. |
31 bool LoadSeed(VariationsSeed* seed); | 31 bool LoadSeed(VariationsSeed* seed); |
32 | 32 |
33 // Stores the given seed data (serialized protobuf data) to local state, along | 33 // Stores the given seed data (serialized protobuf data) to local state, along |
34 // with a base64-encoded digital signature for seed and the date when it was | 34 // with a base64-encoded digital signature for seed and the date when it was |
35 // fetched. The |seed_data| will be base64 encoded for storage. If the string | 35 // fetched. The |seed_data| will be base64 encoded for storage. If the string |
36 // is invalid, the existing prefs are left as is and false is returned. | 36 // is invalid, the existing prefs are left as is and false is returned. Fills |
| 37 // |seed| with the de-serialized protobuf decoded from |seed_data|. |
37 bool StoreSeedData(const std::string& seed_data, | 38 bool StoreSeedData(const std::string& seed_data, |
38 const std::string& base64_seed_signature, | 39 const std::string& base64_seed_signature, |
39 const base::Time& date_fetched); | 40 const base::Time& date_fetched, |
| 41 VariationsSeed* seed); |
40 | 42 |
41 // Updates |kVariationsSeedDate| and logs when previous date was from a | 43 // Updates |kVariationsSeedDate| and logs when previous date was from a |
42 // different day. | 44 // different day. |
43 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); | 45 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); |
44 | 46 |
45 // Returns the serial number of the last loaded or stored seed. | 47 // Returns the serial number of the last loaded or stored seed. |
46 const std::string& variations_serial_number() const { | 48 const std::string& variations_serial_number() const { |
47 return variations_serial_number_; | 49 return variations_serial_number_; |
48 } | 50 } |
49 | 51 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 84 |
83 // Cached serial number from the most recently fetched variations seed. | 85 // Cached serial number from the most recently fetched variations seed. |
84 std::string variations_serial_number_; | 86 std::string variations_serial_number_; |
85 | 87 |
86 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); | 88 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); |
87 }; | 89 }; |
88 | 90 |
89 } // namespace chrome_variations | 91 } // namespace chrome_variations |
90 | 92 |
91 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 93 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
OLD | NEW |