Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1447)

Side by Side Diff: trunk/src/chrome/browser/metrics/variations/variations_seed_store.h

Issue 416333008: Revert 285657 "Move variations component code to variations name..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 13
14 class PrefService; 14 class PrefService;
15 class PrefRegistrySimple; 15 class PrefRegistrySimple;
16 16
17 namespace variations { 17 namespace chrome_variations {
18
18 class VariationsSeed; 19 class VariationsSeed;
19 }
20
21 namespace chrome_variations {
22 20
23 // VariationsSeedStore is a helper class for reading and writing the variations 21 // VariationsSeedStore is a helper class for reading and writing the variations
24 // seed from Local State. 22 // seed from Local State.
25 class VariationsSeedStore { 23 class VariationsSeedStore {
26 public: 24 public:
27 explicit VariationsSeedStore(PrefService* local_state); 25 explicit VariationsSeedStore(PrefService* local_state);
28 virtual ~VariationsSeedStore(); 26 virtual ~VariationsSeedStore();
29 27
30 // 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
31 // 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
32 // successful, |seed| will contain the loaded data and true is returned. 30 // successful, |seed| will contain the loaded data and true is returned.
33 bool LoadSeed(variations::VariationsSeed* seed); 31 bool LoadSeed(VariationsSeed* seed);
34 32
35 // 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
36 // 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
37 // 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
38 // is invalid, the existing prefs are left as is and false is returned. On 36 // is invalid, the existing prefs are left as is and false is returned. On
39 // success and if |parsed_seed| is not NULL, |parsed_seed| will be filled 37 // success and if |parsed_seed| is not NULL, |parsed_seed| will be filled
40 // with the de-serialized protobuf decoded from |seed_data|. 38 // with the de-serialized protobuf decoded from |seed_data|.
41 bool StoreSeedData(const std::string& seed_data, 39 bool StoreSeedData(const std::string& seed_data,
42 const std::string& base64_seed_signature, 40 const std::string& base64_seed_signature,
43 const base::Time& date_fetched, 41 const base::Time& date_fetched,
44 variations::VariationsSeed* parsed_seed); 42 VariationsSeed* parsed_seed);
45 43
46 // Updates |kVariationsSeedDate| and logs when previous date was from a 44 // Updates |kVariationsSeedDate| and logs when previous date was from a
47 // different day. 45 // different day.
48 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched); 46 void UpdateSeedDateAndLogDayChange(const base::Time& server_date_fetched);
49 47
50 // Returns the serial number of the last loaded or stored seed. 48 // Returns the serial number of the last loaded or stored seed.
51 const std::string& variations_serial_number() const { 49 const std::string& variations_serial_number() const {
52 return variations_serial_number_; 50 return variations_serial_number_;
53 } 51 }
54 52
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 85
88 // Cached serial number from the most recently fetched variations seed. 86 // Cached serial number from the most recently fetched variations seed.
89 std::string variations_serial_number_; 87 std::string variations_serial_number_;
90 88
91 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore); 89 DISALLOW_COPY_AND_ASSIGN(VariationsSeedStore);
92 }; 90 };
93 91
94 } // namespace chrome_variations 92 } // namespace chrome_variations
95 93
96 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_ 94 #endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_SEED_STORE_H_
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/io_thread.cc ('k') | trunk/src/chrome/browser/metrics/variations/variations_seed_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698