| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 base::Time GetLastSyncedTime() const; | 74 base::Time GetLastSyncedTime() const; |
| 75 void SetLastSyncedTime(base::Time time); | 75 void SetLastSyncedTime(base::Time time); |
| 76 | 76 |
| 77 bool HasKeepEverythingSynced() const; | 77 bool HasKeepEverythingSynced() const; |
| 78 void SetKeepEverythingSynced(bool keep_everything_synced); | 78 void SetKeepEverythingSynced(bool keep_everything_synced); |
| 79 | 79 |
| 80 // The returned set is guaranteed to be a subset of | 80 // The returned set is guaranteed to be a subset of |
| 81 // |registered_types|. Returns |registered_types| directly if | 81 // |registered_types|. Returns |registered_types| directly if |
| 82 // HasKeepEverythingSynced() is true. | 82 // HasKeepEverythingSynced() is true. |
| 83 syncable::ModelTypeSet GetPreferredDataTypes( | 83 syncable::ModelEnumSet GetPreferredDataTypes( |
| 84 const syncable::ModelTypeSet& registered_types) const; | 84 syncable::ModelEnumSet registered_types) const; |
| 85 // |preferred_types| should be a subset of |registered_types|. All | 85 // |preferred_types| should be a subset of |registered_types|. All |
| 86 // types in |preferred_types| are marked preferred, and all types in | 86 // types in |preferred_types| are marked preferred, and all types in |
| 87 // |registered_types| \ |preferred_types| are marked not preferred. | 87 // |registered_types| \ |preferred_types| are marked not preferred. |
| 88 // Changes are still made to the prefs even if | 88 // Changes are still made to the prefs even if |
| 89 // HasKeepEverythingSynced() is true, but won't be visible until | 89 // HasKeepEverythingSynced() is true, but won't be visible until |
| 90 // SetKeepEverythingSynced(false) is called. | 90 // SetKeepEverythingSynced(false) is called. |
| 91 void SetPreferredDataTypes( | 91 void SetPreferredDataTypes( |
| 92 const syncable::ModelTypeSet& registered_types, | 92 syncable::ModelEnumSet registered_types, |
| 93 const syncable::ModelTypeSet& preferred_types); | 93 syncable::ModelEnumSet preferred_types); |
| 94 | 94 |
| 95 // This pref is set outside of sync. | 95 // This pref is set outside of sync. |
| 96 bool IsManaged() const; | 96 bool IsManaged() const; |
| 97 | 97 |
| 98 std::string GetEncryptionBootstrapToken() const; | 98 std::string GetEncryptionBootstrapToken() const; |
| 99 void SetEncryptionBootstrapToken(const std::string& token); | 99 void SetEncryptionBootstrapToken(const std::string& token); |
| 100 | 100 |
| 101 // InvalidationVersionTracker implementation. | 101 // InvalidationVersionTracker implementation. |
| 102 virtual sync_notifier::InvalidationVersionMap | 102 virtual sync_notifier::InvalidationVersionMap |
| 103 GetAllMaxVersions() const OVERRIDE; | 103 GetAllMaxVersions() const OVERRIDE; |
| 104 virtual void SetMaxVersion(syncable::ModelType model_type, | 104 virtual void SetMaxVersion(syncable::ModelType model_type, |
| 105 int64 max_version) OVERRIDE; | 105 int64 max_version) OVERRIDE; |
| 106 | 106 |
| 107 // Merges the given set of types with the set of acknowledged types. | 107 // Merges the given set of types with the set of acknowledged types. |
| 108 void AcknowledgeSyncedTypes(const syncable::ModelTypeSet& types); | 108 void AcknowledgeSyncedTypes(syncable::ModelEnumSet types); |
| 109 | 109 |
| 110 // content::NotificationObserver implementation. | 110 // content::NotificationObserver implementation. |
| 111 virtual void Observe(int type, | 111 virtual void Observe(int type, |
| 112 const content::NotificationSource& source, | 112 const content::NotificationSource& source, |
| 113 const content::NotificationDetails& details) OVERRIDE; | 113 const content::NotificationDetails& details) OVERRIDE; |
| 114 | 114 |
| 115 // For testing. | 115 // For testing. |
| 116 | 116 |
| 117 void SetManagedForTest(bool is_managed); | 117 void SetManagedForTest(bool is_managed); |
| 118 syncable::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; | 118 syncable::ModelEnumSet GetAcknowledgeSyncedTypesForTest() const; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 void RegisterPreferences(); | 121 void RegisterPreferences(); |
| 122 | 122 |
| 123 void RegisterDataTypePreferredPref( | 123 void RegisterDataTypePreferredPref( |
| 124 syncable::ModelType type, bool is_preferred); | 124 syncable::ModelType type, bool is_preferred); |
| 125 bool GetDataTypePreferred(syncable::ModelType type) const; | 125 bool GetDataTypePreferred(syncable::ModelType type) const; |
| 126 void SetDataTypePreferred(syncable::ModelType type, bool is_preferred); | 126 void SetDataTypePreferred(syncable::ModelType type, bool is_preferred); |
| 127 | 127 |
| 128 base::NonThreadSafe non_thread_safe_; | 128 base::NonThreadSafe non_thread_safe_; |
| 129 | 129 |
| 130 // May be NULL. | 130 // May be NULL. |
| 131 PrefService* const pref_service_; | 131 PrefService* const pref_service_; |
| 132 | 132 |
| 133 ObserverList<SyncPrefObserver> sync_pref_observers_; | 133 ObserverList<SyncPrefObserver> sync_pref_observers_; |
| 134 | 134 |
| 135 // The preference that controls whether sync is under control by | 135 // The preference that controls whether sync is under control by |
| 136 // configuration management. | 136 // configuration management. |
| 137 BooleanPrefMember pref_sync_managed_; | 137 BooleanPrefMember pref_sync_managed_; |
| 138 | 138 |
| 139 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); | 139 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 } // namespace browser_sync | 142 } // namespace browser_sync |
| 143 | 143 |
| 144 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 144 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
| OLD | NEW |