| 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_ |
| 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" | |
| 15 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 16 #include "sync/notifier/invalidation_state_tracker.h" | 15 #include "sync/notifier/invalidation_state_tracker.h" |
| 17 #include "sync/notifier/unacked_invalidation_set.h" | 16 #include "sync/notifier/unacked_invalidation_set.h" |
| 18 | 17 |
| 19 class PrefService; | 18 class PrefService; |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class DictionaryValue; | 21 class DictionaryValue; |
| 23 class ListValue; | 22 class ListValue; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace user_prefs { | 25 namespace user_prefs { |
| 27 class PrefRegistrySyncable; | 26 class PrefRegistrySyncable; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace invalidation { | 29 namespace invalidation { |
| 31 | 30 |
| 32 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, | 31 class InvalidatorStorage : public syncer::InvalidationStateTracker { |
| 33 public syncer::InvalidationStateTracker { | |
| 34 public: | 32 public: |
| 35 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 33 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 36 | 34 |
| 37 // |pref_service| may not be NULL. Does not own |pref_service|. | 35 // |pref_service| may not be NULL. Does not own |pref_service|. |
| 38 explicit InvalidatorStorage(PrefService* pref_service); | 36 explicit InvalidatorStorage(PrefService* pref_service); |
| 39 virtual ~InvalidatorStorage(); | 37 virtual ~InvalidatorStorage(); |
| 40 | 38 |
| 41 // InvalidationStateTracker implementation. | 39 // InvalidationStateTracker implementation. |
| 42 virtual void SetInvalidatorClientId(const std::string& client_id) OVERRIDE; | 40 virtual void ClearAndSetNewClientId(const std::string& client_id) OVERRIDE; |
| 43 virtual std::string GetInvalidatorClientId() const OVERRIDE; | 41 virtual std::string GetInvalidatorClientId() const OVERRIDE; |
| 44 virtual void SetBootstrapData(const std::string& data) OVERRIDE; | 42 virtual void SetBootstrapData(const std::string& data) OVERRIDE; |
| 45 virtual std::string GetBootstrapData() const OVERRIDE; | 43 virtual std::string GetBootstrapData() const OVERRIDE; |
| 46 virtual void SetSavedInvalidations( | 44 virtual void SetSavedInvalidations( |
| 47 const syncer::UnackedInvalidationsMap& map) OVERRIDE; | 45 const syncer::UnackedInvalidationsMap& map) OVERRIDE; |
| 48 virtual syncer::UnackedInvalidationsMap GetSavedInvalidations() | 46 virtual syncer::UnackedInvalidationsMap GetSavedInvalidations() |
| 49 const OVERRIDE; | 47 const OVERRIDE; |
| 50 virtual void Clear() OVERRIDE; | 48 virtual void Clear() OVERRIDE; |
| 51 | 49 |
| 52 private: | 50 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 72 base::ThreadChecker thread_checker_; | 70 base::ThreadChecker thread_checker_; |
| 73 | 71 |
| 74 PrefService* const pref_service_; | 72 PrefService* const pref_service_; |
| 75 | 73 |
| 76 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); | 74 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); |
| 77 }; | 75 }; |
| 78 | 76 |
| 79 } // namespace invalidation | 77 } // namespace invalidation |
| 80 | 78 |
| 81 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ | 79 #endif // CHROME_BROWSER_INVALIDATION_INVALIDATOR_STORAGE_H_ |
| OLD | NEW |