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 #include "base/basictypes.h" | |
10 #include "base/compiler_specific.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/prefs/pref_hash_calculator.h" | |
13 #include "chrome/browser/prefs/pref_hash_store.h" | |
14 | |
15 class PrefService; | |
16 | |
17 namespace base { | |
18 class Value; | |
19 } // namespace base | |
20 | |
21 // Implements PrefHashStoreImpl by storing preference hashes in a PrefService. | |
22 class PrefHashStoreImpl : public PrefHashStore { | |
23 public: | |
24 // Constructs a PrefHashStoreImpl that calculates hashes using |seed| and | |
25 // stores them in |local_state|. Multiple hash stores can use the same | |
26 // |local_state| with distinct |hash_store_id|s. | |
27 // | |
28 // The same |seed| and |hash_store_id| must be used to load and validate | |
29 // previously stored hashes in |local_state|. | |
30 PrefHashStoreImpl(const std::string& seed, | |
31 PrefService* local_state, | |
32 const std::string& hash_store_id); | |
33 | |
34 // PrefHashStore implementation. | |
35 virtual InitializationResult InitializeTrackedValue( | |
36 const std::string& path, const base::Value* initial_value) OVERRIDE; | |
37 | |
38 private: | |
39 class PrefHashTrackerImpl; | |
gab
2013/11/27 23:43:27
Does this need to be a private class? Could it jus
| |
40 | |
41 // PrefHashStore implementation. | |
42 virtual scoped_ptr<PrefHashTracker> CompleteInitialization() OVERRIDE; | |
43 | |
44 PrefService* local_state_; | |
45 std::string hash_store_id_; | |
46 PrefHashCalculator pref_hash_calculator_; | |
47 scoped_ptr<PrefHashTrackerImpl> pref_hash_tracker_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); | |
50 }; | |
51 | |
52 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ | |
OLD | NEW |