| Index: components/variations/variations_seed_store.h
|
| diff --git a/components/variations/variations_seed_store.h b/components/variations/variations_seed_store.h
|
| index 8b24d7b9227a0854c766b7269b2d9f177c1c8384..6d027fdcac4e6c757c6e189c580e4c1efb47590f 100644
|
| --- a/components/variations/variations_seed_store.h
|
| +++ b/components/variations/variations_seed_store.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/macros.h"
|
| #include "base/time/time.h"
|
| #include "build/build_config.h"
|
| +#include "components/variations/metrics.h"
|
|
|
| class PrefService;
|
| class PrefRegistrySimple;
|
| @@ -30,7 +31,7 @@ class VariationsSeedStore {
|
| // Loads the variations seed data from local state into |seed|. If there is a
|
| // problem with loading, the pref value is cleared and false is returned. If
|
| // successful, |seed| will contain the loaded data and true is returned.
|
| - bool LoadSeed(VariationsSeed* seed);
|
| + bool LoadSeed(VariationsSeed* seed) WARN_UNUSED_RESULT;
|
|
|
| // Stores the given seed |data| (serialized protobuf) to local state, along
|
| // with a base64-encoded digital signature for seed and the date when it was
|
| @@ -49,7 +50,7 @@ class VariationsSeedStore {
|
| const base::Time& date_fetched,
|
| bool is_delta_compressed,
|
| bool is_gzip_compressed,
|
| - VariationsSeed* parsed_seed);
|
| + VariationsSeed* parsed_seed) WARN_UNUSED_RESULT;
|
|
|
| // Updates |kVariationsSeedDate| and logs when previous date was from a
|
| // different day.
|
| @@ -71,25 +72,8 @@ class VariationsSeedStore {
|
| static void RegisterPrefs(PrefRegistrySimple* registry);
|
|
|
| protected:
|
| - // Note: UMA histogram enum - don't re-order or remove entries.
|
| - enum VerifySignatureResult {
|
| - VARIATIONS_SEED_SIGNATURE_MISSING,
|
| - VARIATIONS_SEED_SIGNATURE_DECODE_FAILED,
|
| - VARIATIONS_SEED_SIGNATURE_INVALID_SIGNATURE,
|
| - VARIATIONS_SEED_SIGNATURE_INVALID_SEED,
|
| - VARIATIONS_SEED_SIGNATURE_VALID,
|
| - VARIATIONS_SEED_SIGNATURE_ENUM_SIZE,
|
| - };
|
| -
|
| - // Verifies a variations seed (the serialized proto bytes) with the specified
|
| - // base-64 encoded signature that was received from the server and returns the
|
| - // result. The signature is assumed to be an "ECDSA with SHA-256" signature
|
| - // (see kECDSAWithSHA256AlgorithmID in the .cc file). Returns the result of
|
| - // signature verification or VARIATIONS_SEED_SIGNATURE_ENUM_SIZE if signature
|
| - // verification is not enabled.
|
| - virtual VariationsSeedStore::VerifySignatureResult VerifySeedSignature(
|
| - const std::string& seed_bytes,
|
| - const std::string& base64_seed_signature);
|
| + // Whether signature verification is enabled. Overridable for tests.
|
| + virtual bool SignatureVerificationEnabled();
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(VariationsSeedStoreTest, VerifySeedSignature);
|
| @@ -104,8 +88,11 @@ class VariationsSeedStore {
|
| void ImportFirstRunJavaSeed();
|
| #endif // OS_ANDROID
|
|
|
| - // Reads the variations seed data from prefs; returns true on success.
|
| - bool ReadSeedData(std::string* seed_data);
|
| + // Reads the variations seed data from prefs into |seed_data|, and returns the
|
| + // result of the load. The value stored into |seed_data| should only be used
|
| + // if the result is SUCCESS.
|
| + // Side-effect: If the read fails, clears the prefs associated with the seed.
|
| + LoadSeedResult ReadSeedData(std::string* seed_data) WARN_UNUSED_RESULT;
|
|
|
| // Internal version of |StoreSeedData()| that assumes |seed_data| is not delta
|
| // compressed.
|
| @@ -113,13 +100,13 @@ class VariationsSeedStore {
|
| const std::string& base64_seed_signature,
|
| const std::string& country_code,
|
| const base::Time& date_fetched,
|
| - VariationsSeed* parsed_seed);
|
| + VariationsSeed* parsed_seed) WARN_UNUSED_RESULT;
|
|
|
| // Applies a delta-compressed |patch| to |existing_data|, producing the result
|
| // in |output|. Returns whether the operation was successful.
|
| static bool ApplyDeltaPatch(const std::string& existing_data,
|
| const std::string& patch,
|
| - std::string* output);
|
| + std::string* output) WARN_UNUSED_RESULT;
|
|
|
| // The pref service used to persist the variations seed.
|
| PrefService* local_state_;
|
|
|