| 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_FILTER_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_ |
| 6 #define CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Migrates protected values from |source| to |destination|. Values are | 87 // Migrates protected values from |source| to |destination|. Values are |
| 88 // migrated if they are protected according to this filter's configuration, | 88 // migrated if they are protected according to this filter's configuration, |
| 89 // the corresponding key has no value in |destination|, and the value in | 89 // the corresponding key has no value in |destination|, and the value in |
| 90 // |source| is trusted according to this filter's PrefHashStore. Regardless of | 90 // |source| is trusted according to this filter's PrefHashStore. Regardless of |
| 91 // the state of |destination| or the trust status, the protected values will | 91 // the state of |destination| or the trust status, the protected values will |
| 92 // be removed from |source|. | 92 // be removed from |source|. |
| 93 void MigrateValues(PersistentPrefStore* source, | 93 void MigrateValues(PersistentPrefStore* source, |
| 94 PersistentPrefStore* destination); | 94 PersistentPrefStore* destination); |
| 95 | 95 |
| 96 // PrefFilter implementation. | 96 // PrefFilter implementation. |
| 97 virtual void FilterOnLoad(base::DictionaryValue* pref_store_contents) | 97 virtual bool FilterOnLoad(base::DictionaryValue* pref_store_contents) |
| 98 OVERRIDE; | 98 OVERRIDE; |
| 99 virtual void FilterUpdate(const std::string& path) OVERRIDE; | 99 virtual void FilterUpdate(const std::string& path) OVERRIDE; |
| 100 virtual void FilterSerializeData( | 100 virtual void FilterSerializeData( |
| 101 const base::DictionaryValue* pref_store_contents) OVERRIDE; | 101 const base::DictionaryValue* pref_store_contents) OVERRIDE; |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 // A map of paths to TrackedPreferences; this map owns this individual | 104 // A map of paths to TrackedPreferences; this map owns this individual |
| 105 // TrackedPreference objects. | 105 // TrackedPreference objects. |
| 106 typedef base::ScopedPtrHashMap<std::string, TrackedPreference> | 106 typedef base::ScopedPtrHashMap<std::string, TrackedPreference> |
| 107 TrackedPreferencesMap; | 107 TrackedPreferencesMap; |
| 108 // A map from changed paths to their corresponding TrackedPreferences (which | 108 // A map from changed paths to their corresponding TrackedPreferences (which |
| 109 // aren't owned by this map). | 109 // aren't owned by this map). |
| 110 typedef std::map<std::string, const TrackedPreference*> ChangedPathsMap; | 110 typedef std::map<std::string, const TrackedPreference*> ChangedPathsMap; |
| 111 | 111 |
| 112 scoped_ptr<PrefHashStore> pref_hash_store_; | 112 scoped_ptr<PrefHashStore> pref_hash_store_; |
| 113 | 113 |
| 114 TrackedPreferencesMap tracked_paths_; | 114 TrackedPreferencesMap tracked_paths_; |
| 115 | 115 |
| 116 // The set of all paths whose value has changed since the last call to | 116 // The set of all paths whose value has changed since the last call to |
| 117 // FilterSerializeData. | 117 // FilterSerializeData. |
| 118 ChangedPathsMap changed_paths_; | 118 ChangedPathsMap changed_paths_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(PrefHashFilter); | 120 DISALLOW_COPY_AND_ASSIGN(PrefHashFilter); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 #endif // CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_ | 123 #endif // CHROME_BROWSER_PREFS_PREF_HASH_FILTER_H_ |
| OLD | NEW |