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 #include "chrome/browser/prefs/tracked/pref_hash_store_impl.h" | 5 #include "chrome/browser/prefs/tracked/pref_hash_store_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/prefs/tracked/hash_store_contents.h" | 10 #include "chrome/browser/prefs/tracked/hash_store_contents.h" |
11 #include "chrome/browser/prefs/tracked/pref_hash_store_transaction.h" | 11 #include "chrome/browser/prefs/tracked/pref_hash_store_transaction.h" |
12 | 12 |
13 class PrefHashStoreImpl::PrefHashStoreTransactionImpl | 13 class PrefHashStoreImpl::PrefHashStoreTransactionImpl |
14 : public PrefHashStoreTransaction { | 14 : public PrefHashStoreTransaction { |
15 public: | 15 public: |
16 // Constructs a PrefHashStoreTransactionImpl which can use the private | 16 // Constructs a PrefHashStoreTransactionImpl which can use the private |
17 // members of its |outer| PrefHashStoreImpl. | 17 // members of its |outer| PrefHashStoreImpl. |
18 PrefHashStoreTransactionImpl(PrefHashStoreImpl* outer, | 18 PrefHashStoreTransactionImpl(PrefHashStoreImpl* outer, |
19 scoped_ptr<HashStoreContents> storage); | 19 scoped_ptr<HashStoreContents> storage); |
20 virtual ~PrefHashStoreTransactionImpl(); | 20 virtual ~PrefHashStoreTransactionImpl(); |
21 | 21 |
22 // PrefHashStoreTransaction implementation. | 22 // PrefHashStoreTransaction implementation. |
23 virtual ValueState CheckValue(const std::string& path, | 23 virtual ValueState CheckValue(const std::string& path, |
24 const base::Value* value) const OVERRIDE; | 24 const base::Value* value) const override; |
25 virtual void StoreHash(const std::string& path, | 25 virtual void StoreHash(const std::string& path, |
26 const base::Value* value) OVERRIDE; | 26 const base::Value* value) override; |
27 virtual ValueState CheckSplitValue( | 27 virtual ValueState CheckSplitValue( |
28 const std::string& path, | 28 const std::string& path, |
29 const base::DictionaryValue* initial_split_value, | 29 const base::DictionaryValue* initial_split_value, |
30 std::vector<std::string>* invalid_keys) const OVERRIDE; | 30 std::vector<std::string>* invalid_keys) const override; |
31 virtual void StoreSplitHash( | 31 virtual void StoreSplitHash( |
32 const std::string& path, | 32 const std::string& path, |
33 const base::DictionaryValue* split_value) OVERRIDE; | 33 const base::DictionaryValue* split_value) override; |
34 virtual bool HasHash(const std::string& path) const OVERRIDE; | 34 virtual bool HasHash(const std::string& path) const override; |
35 virtual void ImportHash(const std::string& path, | 35 virtual void ImportHash(const std::string& path, |
36 const base::Value* hash) OVERRIDE; | 36 const base::Value* hash) override; |
37 virtual void ClearHash(const std::string& path) OVERRIDE; | 37 virtual void ClearHash(const std::string& path) override; |
38 virtual bool IsSuperMACValid() const OVERRIDE; | 38 virtual bool IsSuperMACValid() const override; |
39 virtual bool StampSuperMac() OVERRIDE; | 39 virtual bool StampSuperMac() override; |
40 | 40 |
41 private: | 41 private: |
42 bool GetSplitMacs(const std::string& path, | 42 bool GetSplitMacs(const std::string& path, |
43 std::map<std::string, std::string>* split_macs) const; | 43 std::map<std::string, std::string>* split_macs) const; |
44 | 44 |
45 HashStoreContents* contents() { | 45 HashStoreContents* contents() { |
46 return outer_->legacy_hash_store_contents_ | 46 return outer_->legacy_hash_store_contents_ |
47 ? outer_->legacy_hash_store_contents_.get() | 47 ? outer_->legacy_hash_store_contents_.get() |
48 : contents_.get(); | 48 : contents_.get(); |
49 } | 49 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::IsSuperMACValid() const { | 305 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::IsSuperMACValid() const { |
306 return super_mac_valid_; | 306 return super_mac_valid_; |
307 } | 307 } |
308 | 308 |
309 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::StampSuperMac() { | 309 bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::StampSuperMac() { |
310 if (!outer_->use_super_mac_ || super_mac_valid_) | 310 if (!outer_->use_super_mac_ || super_mac_valid_) |
311 return false; | 311 return false; |
312 super_mac_dirty_ = true; | 312 super_mac_dirty_ = true; |
313 return true; | 313 return true; |
314 } | 314 } |
OLD | NEW |