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 #ifndef CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "chrome/browser/prefs/pref_member.h" | 15 #include "chrome/browser/prefs/pref_member.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "sync/notifier/invalidation_version_tracker.h" | 17 #include "sync/notifier/invalidation_state_tracker.h" |
18 #include "sync/syncable/model_type.h" | 18 #include "sync/syncable/model_type.h" |
19 | 19 |
20 class PrefService; | 20 class PrefService; |
21 | 21 |
22 namespace browser_sync { | 22 namespace browser_sync { |
23 | 23 |
24 class SyncPrefObserver { | 24 class SyncPrefObserver { |
25 public: | 25 public: |
26 // Called whenever the pref that controls whether sync is managed | 26 // Called whenever the pref that controls whether sync is managed |
27 // changes. | 27 // changes. |
(...skipping 10 matching lines...) Expand all Loading... |
38 // TODO(akalin): Some classes still read the prefs directly. Consider | 38 // TODO(akalin): Some classes still read the prefs directly. Consider |
39 // passing down a pointer to SyncPrefs to them. A list of files: | 39 // passing down a pointer to SyncPrefs to them. A list of files: |
40 // | 40 // |
41 // profile_sync_service_startup_unittest.cc | 41 // profile_sync_service_startup_unittest.cc |
42 // profile_sync_service.cc | 42 // profile_sync_service.cc |
43 // sync_setup_flow.cc | 43 // sync_setup_flow.cc |
44 // sync_setup_wizard.cc | 44 // sync_setup_wizard.cc |
45 // sync_setup_wizard_unittest.cc | 45 // sync_setup_wizard_unittest.cc |
46 // two_client_preferences_sync_test.cc | 46 // two_client_preferences_sync_test.cc |
47 class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>, | 47 class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs>, |
48 public sync_notifier::InvalidationVersionTracker, | 48 public sync_notifier::InvalidationStateTracker, |
49 public content::NotificationObserver { | 49 public content::NotificationObserver { |
50 public: | 50 public: |
51 // |pref_service| may be NULL (for unit tests), but in that case no | 51 // |pref_service| may be NULL (for unit tests), but in that case no |
52 // setter methods should be called. Does not take ownership of | 52 // setter methods should be called. Does not take ownership of |
53 // |pref_service|. | 53 // |pref_service|. |
54 explicit SyncPrefs(PrefService* pref_service); | 54 explicit SyncPrefs(PrefService* pref_service); |
55 | 55 |
56 virtual ~SyncPrefs(); | 56 virtual ~SyncPrefs(); |
57 | 57 |
58 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer); | 58 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 std::string GetEncryptionBootstrapToken() const; | 99 std::string GetEncryptionBootstrapToken() const; |
100 void SetEncryptionBootstrapToken(const std::string& token); | 100 void SetEncryptionBootstrapToken(const std::string& token); |
101 | 101 |
102 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
103 // Use this spare bootstrap token only when setting up sync for the first | 103 // Use this spare bootstrap token only when setting up sync for the first |
104 // time. | 104 // time. |
105 std::string GetSpareBootstrapToken() const; | 105 std::string GetSpareBootstrapToken() const; |
106 void SetSpareBootstrapToken(const std::string& token); | 106 void SetSpareBootstrapToken(const std::string& token); |
107 #endif | 107 #endif |
108 | 108 |
109 // InvalidationVersionTracker implementation. | 109 // InvalidationStateTracker implementation. |
110 virtual sync_notifier::InvalidationVersionMap | 110 virtual sync_notifier::InvalidationVersionMap |
111 GetAllMaxVersions() const OVERRIDE; | 111 GetAllMaxVersions() const OVERRIDE; |
112 virtual void SetMaxVersion(syncable::ModelType model_type, | 112 virtual void SetMaxVersion(syncable::ModelType model_type, |
113 int64 max_version) OVERRIDE; | 113 int64 max_version) OVERRIDE; |
114 | 114 |
115 // Merges the given set of types with the set of acknowledged types. | 115 // Merges the given set of types with the set of acknowledged types. |
116 void AcknowledgeSyncedTypes(syncable::ModelTypeSet types); | 116 void AcknowledgeSyncedTypes(syncable::ModelTypeSet types); |
117 | 117 |
118 // content::NotificationObserver implementation. | 118 // content::NotificationObserver implementation. |
119 virtual void Observe(int type, | 119 virtual void Observe(int type, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // etc. | 160 // etc. |
161 typedef std::map<syncable::ModelType, syncable::ModelTypeSet> PrefGroupsMap; | 161 typedef std::map<syncable::ModelType, syncable::ModelTypeSet> PrefGroupsMap; |
162 PrefGroupsMap pref_groups_; | 162 PrefGroupsMap pref_groups_; |
163 | 163 |
164 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); | 164 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); |
165 }; | 165 }; |
166 | 166 |
167 } // namespace browser_sync | 167 } // namespace browser_sync |
168 | 168 |
169 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 169 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
OLD | NEW |