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 COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 5 #ifndef COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 6 #define COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "components/user_prefs/tracked/pref_hash_calculator.h" | 13 #include "components/user_prefs/tracked/pref_hash_calculator.h" |
14 #include "components/user_prefs/tracked/pref_hash_store.h" | 14 #include "components/user_prefs/tracked/pref_hash_store.h" |
15 | 15 |
16 class HashStoreContents; | 16 class HashStoreContents; |
17 class PrefHashStoreTransaction; | 17 class PrefHashStoreTransaction; |
18 | 18 |
19 // Implements PrefHashStoreImpl by storing preference hashes in a | 19 // Implements PrefHashStoreImpl by storing preference hashes in a |
20 // HashStoreContents. | 20 // HashStoreContents. |
21 class PrefHashStoreImpl : public PrefHashStore { | 21 class PrefHashStoreImpl : public PrefHashStore { |
22 public: | 22 public: |
(...skipping 14 matching lines...) Expand all Loading... |
37 // previously stored hashes in |contents|. | 37 // previously stored hashes in |contents|. |
38 PrefHashStoreImpl(const std::string& seed, | 38 PrefHashStoreImpl(const std::string& seed, |
39 const std::string& device_id, | 39 const std::string& device_id, |
40 bool use_super_mac); | 40 bool use_super_mac); |
41 | 41 |
42 ~PrefHashStoreImpl() override; | 42 ~PrefHashStoreImpl() override; |
43 | 43 |
44 // Provides an external HashStoreContents implementation to be used. | 44 // Provides an external HashStoreContents implementation to be used. |
45 // BeginTransaction() will ignore |storage| if this is provided. | 45 // BeginTransaction() will ignore |storage| if this is provided. |
46 void set_legacy_hash_store_contents( | 46 void set_legacy_hash_store_contents( |
47 scoped_ptr<HashStoreContents> legacy_hash_store_contents); | 47 std::unique_ptr<HashStoreContents> legacy_hash_store_contents); |
48 | 48 |
49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return | 49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return |
50 // false after this call. | 50 // false after this call. |
51 void Reset(); | 51 void Reset(); |
52 | 52 |
53 // PrefHashStore implementation. | 53 // PrefHashStore implementation. |
54 scoped_ptr<PrefHashStoreTransaction> BeginTransaction( | 54 std::unique_ptr<PrefHashStoreTransaction> BeginTransaction( |
55 scoped_ptr<HashStoreContents> storage) override; | 55 std::unique_ptr<HashStoreContents> storage) override; |
56 | 56 |
57 private: | 57 private: |
58 class PrefHashStoreTransactionImpl; | 58 class PrefHashStoreTransactionImpl; |
59 | 59 |
60 const PrefHashCalculator pref_hash_calculator_; | 60 const PrefHashCalculator pref_hash_calculator_; |
61 scoped_ptr<HashStoreContents> legacy_hash_store_contents_; | 61 std::unique_ptr<HashStoreContents> legacy_hash_store_contents_; |
62 bool use_super_mac_; | 62 bool use_super_mac_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); | 64 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); |
65 }; | 65 }; |
66 | 66 |
67 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ | 67 #endif // COMPONENTS_USER_PREFS_TRACKED_PREF_HASH_STORE_IMPL_H_ |
OLD | NEW |