OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers | 5 // Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers |
6 // to use PrefService as persistence for invalidation state. It is not thread | 6 // to use PrefService as persistence for invalidation state. It is not thread |
7 // safe, and lives on the UI thread. | 7 // safe, and lives on the UI thread. |
8 | 8 |
9 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ | 9 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
10 #define CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ | 10 #define CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
(...skipping 15 matching lines...) Expand all Loading... |
26 class PrefRegistrySyncable; | 26 class PrefRegistrySyncable; |
27 } | 27 } |
28 | 28 |
29 namespace invalidation { | 29 namespace invalidation { |
30 | 30 |
31 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, | 31 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, |
32 public syncer::InvalidationStateTracker { | 32 public syncer::InvalidationStateTracker { |
33 public: | 33 public: |
34 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 34 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
35 | 35 |
36 // |pref_service| may be NULL (for unit tests), but in that case no setter | 36 // |pref_service| may not be NULL. Does not own |pref_service|. |
37 // methods should be called. Does not own |pref_service|. | |
38 explicit InvalidatorStorage(PrefService* pref_service); | 37 explicit InvalidatorStorage(PrefService* pref_service); |
39 virtual ~InvalidatorStorage(); | 38 virtual ~InvalidatorStorage(); |
40 | 39 |
41 // InvalidationStateTracker implementation. | 40 // InvalidationStateTracker implementation. |
42 virtual syncer::InvalidationStateMap GetAllInvalidationStates() const | 41 virtual syncer::InvalidationStateMap GetAllInvalidationStates() const |
43 OVERRIDE; | 42 OVERRIDE; |
44 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, | 43 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, |
45 int64 max_version, | 44 int64 max_version, |
46 const std::string& payload) OVERRIDE; | 45 const std::string& payload) OVERRIDE; |
47 virtual void Forget(const syncer::ObjectIdSet& ids) OVERRIDE; | 46 virtual void Forget(const syncer::ObjectIdSet& ids) OVERRIDE; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 static void SerializeToList( | 85 static void SerializeToList( |
87 const syncer::InvalidationStateMap& state_map, | 86 const syncer::InvalidationStateMap& state_map, |
88 base::ListValue* state_map_list); | 87 base::ListValue* state_map_list); |
89 | 88 |
90 // Code for migrating from old MaxInvalidationVersions pref, which was a map | 89 // Code for migrating from old MaxInvalidationVersions pref, which was a map |
91 // from sync types to max invalidation versions. | 90 // from sync types to max invalidation versions. |
92 void MigrateMaxInvalidationVersionsPref(); | 91 void MigrateMaxInvalidationVersionsPref(); |
93 static void DeserializeMap(const base::DictionaryValue* max_versions_dict, | 92 static void DeserializeMap(const base::DictionaryValue* max_versions_dict, |
94 syncer::InvalidationStateMap* map); | 93 syncer::InvalidationStateMap* map); |
95 | 94 |
96 // May be NULL. | |
97 PrefService* const pref_service_; | 95 PrefService* const pref_service_; |
98 | 96 |
99 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); | 97 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); |
100 }; | 98 }; |
101 | 99 |
102 } // namespace invalidation | 100 } // namespace invalidation |
103 | 101 |
104 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ | 102 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
OLD | NEW |