OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_PREFS_PREF_HASH_STORE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 VERSION_LATEST = 2, | 35 VERSION_LATEST = 2, |
36 }; | 36 }; |
37 | 37 |
38 // Constructs a PrefHashStoreImpl that calculates hashes using | 38 // Constructs a PrefHashStoreImpl that calculates hashes using |
39 // |seed| and |device_id| and stores them in |contents|. | 39 // |seed| and |device_id| and stores them in |contents|. |
40 // | 40 // |
41 // The same |seed| and |device_id| must be used to load and validate | 41 // The same |seed| and |device_id| must be used to load and validate |
42 // previously stored hashes in |contents|. | 42 // previously stored hashes in |contents|. |
43 PrefHashStoreImpl(const std::string& seed, | 43 PrefHashStoreImpl(const std::string& seed, |
44 const std::string& device_id, | 44 const std::string& device_id, |
45 scoped_ptr<HashStoreContents> contents, | |
46 bool use_super_mac); | 45 bool use_super_mac); |
47 | 46 |
48 virtual ~PrefHashStoreImpl(); | 47 virtual ~PrefHashStoreImpl(); |
49 | 48 |
50 // Clears the contents of this PrefHashStore. |IsInitialized()| will return | 49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return |
51 // false after this call. | 50 // false after this call. |
52 void Reset(); | 51 void Reset(); |
53 | 52 |
54 // PrefHashStore implementation. | 53 // PrefHashStore implementation. |
55 virtual scoped_ptr<PrefHashStoreTransaction> BeginTransaction() OVERRIDE; | 54 virtual scoped_ptr<PrefHashStoreTransaction> BeginTransaction( |
56 virtual void CommitPendingWrite() OVERRIDE; | 55 base::DictionaryValue* storage) OVERRIDE; |
57 | 56 |
58 private: | 57 private: |
59 class PrefHashStoreTransactionImpl; | 58 class PrefHashStoreTransactionImpl; |
60 | 59 |
61 const PrefHashCalculator pref_hash_calculator_; | 60 const PrefHashCalculator pref_hash_calculator_; |
62 scoped_ptr<HashStoreContents> contents_; | |
63 const bool initial_hashes_dictionary_trusted_; | |
64 bool use_super_mac_; | 61 bool use_super_mac_; |
65 | 62 |
66 // True if hashes have been modified since the last call to | |
67 // CommitPendingWriteIfRequired(). | |
68 bool has_pending_write_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); | 63 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); |
71 }; | 64 }; |
72 | 65 |
73 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ | 66 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ |
OLD | NEW |