| 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_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ | 9 #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
| 10 #define CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ | 10 #define CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "sync/notifier/invalidation_state_tracker.h" | 16 #include "sync/notifier/invalidation_state_tracker.h" |
| 17 | 17 |
| 18 class PrefService; | 18 class PrefService; |
| 19 class PrefRegistrySyncable; | 19 class PrefRegistrySyncable; |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class DictionaryValue; | 22 class DictionaryValue; |
| 23 class ListValue; | 23 class ListValue; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace browser_sync { | 26 namespace invalidation { |
| 27 | 27 |
| 28 // TODO(tim): Bug 124137. We may want to move this outside of sync/ into a | |
| 29 // browser/invalidations directory, or re-organize to have a browser | |
| 30 // subdirectory that contains signin/ sync/ invalidations/ and other cloud | |
| 31 // services. For now this is still tied to sync while we refactor, so minimize | |
| 32 // churn and keep it here. | |
| 33 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, | 28 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, |
| 34 public syncer::InvalidationStateTracker { | 29 public syncer::InvalidationStateTracker { |
| 35 public: | 30 public: |
| 36 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 31 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
| 37 | 32 |
| 38 // |pref_service| may be NULL (for unit tests), but in that case no setter | 33 // |pref_service| may be NULL (for unit tests), but in that case no setter |
| 39 // methods should be called. Does not own |pref_service|. | 34 // methods should be called. Does not own |pref_service|. |
| 40 explicit InvalidatorStorage(PrefService* pref_service); | 35 explicit InvalidatorStorage(PrefService* pref_service); |
| 41 virtual ~InvalidatorStorage(); | 36 virtual ~InvalidatorStorage(); |
| 42 | 37 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void MigrateMaxInvalidationVersionsPref(); | 89 void MigrateMaxInvalidationVersionsPref(); |
| 95 static void DeserializeMap(const base::DictionaryValue* max_versions_dict, | 90 static void DeserializeMap(const base::DictionaryValue* max_versions_dict, |
| 96 syncer::InvalidationStateMap* map); | 91 syncer::InvalidationStateMap* map); |
| 97 | 92 |
| 98 // May be NULL. | 93 // May be NULL. |
| 99 PrefService* const pref_service_; | 94 PrefService* const pref_service_; |
| 100 | 95 |
| 101 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); | 96 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); |
| 102 }; | 97 }; |
| 103 | 98 |
| 104 } // namespace browser_sync | 99 } // namespace invalidation |
| 105 | 100 |
| 106 #endif // CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ | 101 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
| OLD | NEW |