| 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. On |
| 37 // success and if |parsed_seed| is not NULL, |parsed_seed| will be filled |
| 38 // with the de-serialized protobuf decoded from |seed_data|. |
| 37 bool StoreSeedData(const std::string& seed_data, | 39 bool StoreSeedData(const std::string& seed_data, |
| 38 const std::string& base64_seed_signature, | 40 const std::string& base64_seed_signature, |
| 39 const base::Time& date_fetched); | 41 const base::Time& date_fetched, |
| 42 VariationsSeed* parsed_seed); |
| 40 | 43 |
| 41 // Updates |kVariationsSeedDate| and logs when previous date was from a | 44 // Updates |kVariationsSeedDate| and logs when previous date was from a |
| 42 // different day. | 45 // different day. |
| 43 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); | 46 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); |
| 44 | 47 |
| 45 // Returns the serial number of the last loaded or stored seed. | 48 // Returns the serial number of the last loaded or stored seed. |
| 46 const std::string& variations_serial_number() const { | 49 const std::string& variations_serial_number() const { |
| 47 return variations_serial_number_; | 50 return variations_serial_number_; |
| 48 } | 51 } |
| 49 | 52 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 85 |
| 83 // Cached serial number from the most recently fetched variations seed. | 86 // Cached serial number from the most recently fetched variations seed. |
| 84 std::string variations_serial_number_; | 87 std::string variations_serial_number_; |
| 85 | 88 |
| 86 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); | 89 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 } // namespace chrome_variations | 92 } // namespace chrome_variations |
| 90 | 93 |
| 91 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ | 94 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ |
| OLD | NEW |