| 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_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
| 6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 | 11 |
| 12 class PrefHashTracker; | |
| 13 | |
| 14 namespace base { | 12 namespace base { |
| 15 class Value; | 13 class Value; |
| 16 } // namespace base | 14 } // namespace base |
| 17 | 15 |
| 18 // Stores hashes of and verifies preference values. To use, first call | 16 // Stores hashes of and verifies preference values. To use, first call |
| 19 // |InitializeTrackedValue| with each preference that should be tracked. Then | 17 // |InitializeTrackedValue| with each preference that should be tracked. Then |
| 20 // call |OnPrefValueChanged| to update the hash store when preference values | 18 // call |OnPrefValueChanged| to update the hash store when preference values |
| 21 // change. | 19 // change. |
| 22 class PrefHashStore { | 20 class PrefHashStore { |
| 23 public: | 21 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 // The preference value has been changed since the last hash. | 32 // The preference value has been changed since the last hash. |
| 35 CHANGED, | 33 CHANGED, |
| 36 // No stored hash exists for the preference value. | 34 // No stored hash exists for the preference value. |
| 37 UNKNOWN_VALUE, | 35 UNKNOWN_VALUE, |
| 38 }; | 36 }; |
| 39 | 37 |
| 40 // Checks |initial_value| against the existing stored value hash. | 38 // Checks |initial_value| against the existing stored value hash. |
| 41 virtual ValueState CheckValue( | 39 virtual ValueState CheckValue( |
| 42 const std::string& path, const base::Value* initial_value) const = 0; | 40 const std::string& path, const base::Value* initial_value) const = 0; |
| 43 | 41 |
| 44 // Stores a hash of the current value of the preference at |path|. | 42 // Stores a hash of the current |value| of the preference at |path|. |
| 45 virtual void StoreHash(const std::string& path, | 43 virtual void StoreHash(const std::string& path, |
| 46 const base::Value* value) = 0; | 44 const base::Value* value) = 0; |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ | 47 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_H_ |
| OLD | NEW |