summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/sync_prefs.h
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 03:04:13 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 03:04:13 +0000
commite3b0ee5f1dc1647f3f00439c9a7f9bb7e97345dd (patch)
tree1a3d69ff713b154f619f2115aab7284bbe6cac5e /chrome/browser/sync/sync_prefs.h
parent8c9add0068743ba549a235e4748e686d8622f3b3 (diff)
downloadchromium_src-e3b0ee5f1dc1647f3f00439c9a7f9bb7e97345dd.zip
chromium_src-e3b0ee5f1dc1647f3f00439c9a7f9bb7e97345dd.tar.gz
chromium_src-e3b0ee5f1dc1647f3f00439c9a7f9bb7e97345dd.tar.bz2
[Sync] Persist invalidation versions to preferences
Define InvalidationVersionTracker interface and make SyncPrefs inherit from it. Pass down SyncPrefs (as InvalidationVersionTracker) all the way down to ChromeInvalidationClient and call it when there is a new max invalidation version. Pass SyncBackendHost a WeakPtr instead of a raw pointer to SyncPrefs. Made sync_listen_notifications work again. BUG=85286 TEST= Review URL: http://codereview.chromium.org/8188006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104983 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sync_prefs.h')
-rw-r--r--chrome/browser/sync/sync_prefs.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/sync/sync_prefs.h b/chrome/browser/sync/sync_prefs.h
index f8f4cda..052304a 100644
--- a/chrome/browser/sync/sync_prefs.h
+++ b/chrome/browser/sync/sync_prefs.h
@@ -8,10 +8,12 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/browser/sync/notifier/invalidation_version_tracker.h"
#include "chrome/browser/sync/syncable/model_type.h"
#include "content/common/notification_observer.h"
@@ -30,7 +32,8 @@ class SyncPrefObserver {
};
// SyncPrefs is a helper class that manages getting, setting, and
-// persisting global sync preferences.
+// persisting global sync preferences. It is not thread-safe, and
+// lives on the UI thread.
//
// TODO(akalin): Some classes still read the prefs directly. Consider
// passing down a pointer to SyncPrefs to them. A list of files:
@@ -41,7 +44,9 @@ class SyncPrefObserver {
// sync_setup_wizard.cc
// sync_setup_wizard_unittest.cc
// two_client_preferences_sync_test.cc
-class SyncPrefs : public NotificationObserver {
+class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>,
+ public sync_notifier::InvalidationVersionTracker,
+ public NotificationObserver {
public:
// |pref_service| may be NULL (for unit tests), but in that case no
// setter methods should be called. Does not take ownership of
@@ -91,6 +96,12 @@ class SyncPrefs : public NotificationObserver {
std::string GetEncryptionBootstrapToken() const;
void SetEncryptionBootstrapToken(const std::string& token);
+ // InvalidationVersionTracker implementation.
+ virtual sync_notifier::InvalidationVersionMap
+ GetAllMaxVersions() const OVERRIDE;
+ virtual void SetMaxVersion(syncable::ModelType model_type,
+ int64 max_version) OVERRIDE;
+
// Merges the given set of types with the set of acknowledged types.
void AcknowledgeSyncedTypes(const syncable::ModelTypeSet& types);