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

Side by Side Diff: components/user_prefs/tracked/pref_hash_store_impl.h

Issue 2782803002: Move tracked prefs into services/preferences/tracked. (Closed)
Patch Set: rebase Created 3 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_
6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "components/user_prefs/tracked/pref_hash_calculator.h"
11 #include "components/user_prefs/tracked/pref_hash_store.h"
12
13 // Implements PrefHashStoreImpl by storing preference hashes in a
14 // HashStoreContents.
15 class PrefHashStoreImpl : public PrefHashStore {
16 public:
17 enum StoreVersion {
18 // No hashes have been stored in this PrefHashStore yet.
19 VERSION_UNINITIALIZED = 0,
20 // The hashes in this PrefHashStore were stored before the introduction
21 // of a version number and should be re-initialized.
22 VERSION_PRE_MIGRATION = 1,
23 // The hashes in this PrefHashStore were stored using the latest algorithm.
24 VERSION_LATEST = 2,
25 };
26
27 // Constructs a PrefHashStoreImpl that calculates hashes using
28 // |seed| and |legacy_device_id| and stores them in |contents|.
29 //
30 // The same |seed| and |legacy_device_id| must be used to load and validate
31 // previously stored hashes in |contents|.
32 PrefHashStoreImpl(const std::string& seed,
33 const std::string& legacy_device_id,
34 bool use_super_mac);
35
36 ~PrefHashStoreImpl() override;
37
38 // Clears the contents of this PrefHashStore. |IsInitialized()| will return
39 // false after this call.
40 void Reset();
41
42 // PrefHashStore implementation.
43 std::unique_ptr<PrefHashStoreTransaction> BeginTransaction(
44 HashStoreContents* storage) override;
45
46 std::string ComputeMac(const std::string& path,
47 const base::Value* new_value) override;
48 std::unique_ptr<base::DictionaryValue> ComputeSplitMacs(
49 const std::string& path,
50 const base::DictionaryValue* split_values) override;
51
52 private:
53 class PrefHashStoreTransactionImpl;
54
55 const PrefHashCalculator pref_hash_calculator_;
56 bool use_super_mac_;
57
58 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl);
59 };
60
61 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_
OLDNEW
« no previous file with comments | « components/user_prefs/tracked/pref_hash_store.h ('k') | components/user_prefs/tracked/pref_hash_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698