OLD | NEW |
---|---|
(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 CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ | |
6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "chrome/browser/prefs/pref_hash_calculator.h" | |
14 #include "chrome/browser/prefs/pref_hash_store.h" | |
15 | |
16 class PrefRegistrySimple; | |
17 class PrefService; | |
18 | |
19 namespace base { | |
20 class Value; | |
21 } // namespace base | |
22 | |
23 // Implements PrefHashStoreImpl by storing preference hashes in a PrefService. | |
24 class PrefHashStoreImpl : public PrefHashStore { | |
Bernhard Bauer
2013/12/10 16:52:07
Are you sure that it's worth using an abstract int
erikwright (departed)
2013/12/12 15:53:30
There is another implementation, in the newly adde
Bernhard Bauer
2013/12/13 19:35:50
FWIW, you could use a TestingPrefStore, which is f
| |
25 public: | |
26 // Constructs a PrefHashStoreImpl that calculates hashes using | |
27 // |seed| and |device_id| and stores them in |local_state|. Multiple hash | |
28 // stores can use the same |local_state| with distinct |hash_store_id|s. | |
29 // | |
30 // The same |seed|, |device_id|, and |hash_store_id| must be used to load and | |
31 // validate previously stored hashes in |local_state|. | |
32 // | |
33 // |local_state| must have previously been passed to |RegisterPrefs|. | |
34 PrefHashStoreImpl(const std::string& hash_store_id, | |
35 const std::string& seed, | |
36 const std::string& device_id, | |
37 PrefService* local_state); | |
38 | |
39 // Registers required local state preferences. | |
40 static void RegisterPrefs(PrefRegistrySimple* registry); | |
41 | |
42 // PrefHashStore implementation. | |
43 virtual ValueState CheckValue(const std::string& path, | |
44 const base::Value* value) const OVERRIDE; | |
45 virtual void StoreValue(const std::string& path, | |
46 const base::Value* value) OVERRIDE; | |
47 | |
48 private: | |
49 std::string hash_store_id_; | |
50 PrefHashCalculator pref_hash_calculator_; | |
51 PrefService* local_state_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); | |
54 }; | |
55 | |
56 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ | |
OLD | NEW |