Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: chrome/browser/sync/sync_prefs.h

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 syncer::ModelTypeSet GetPreferredDataTypes(
84 syncable::ModelTypeSet registered_types) const; 84 syncer::ModelTypeSet 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 syncable::ModelTypeSet registered_types, 92 syncer::ModelTypeSet registered_types,
93 syncable::ModelTypeSet preferred_types); 93 syncer::ModelTypeSet 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 // Use this encryption bootstrap token once already syncing. 98 // Use this encryption bootstrap token once already syncing.
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 // Merges the given set of types with the set of acknowledged types. 109 // Merges the given set of types with the set of acknowledged types.
110 void AcknowledgeSyncedTypes(syncable::ModelTypeSet types); 110 void AcknowledgeSyncedTypes(syncer::ModelTypeSet types);
111 111
112 // content::NotificationObserver implementation. 112 // content::NotificationObserver implementation.
113 virtual void Observe(int type, 113 virtual void Observe(int type,
114 const content::NotificationSource& source, 114 const content::NotificationSource& source,
115 const content::NotificationDetails& details) OVERRIDE; 115 const content::NotificationDetails& details) OVERRIDE;
116 116
117 // For testing. 117 // For testing.
118 118
119 void SetManagedForTest(bool is_managed); 119 void SetManagedForTest(bool is_managed);
120 syncable::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const; 120 syncer::ModelTypeSet GetAcknowledgeSyncedTypesForTest() const;
121 121
122 private: 122 private:
123 void RegisterPrefGroups(); 123 void RegisterPrefGroups();
124 void RegisterPreferences(); 124 void RegisterPreferences();
125 125
126 void RegisterDataTypePreferredPref( 126 void RegisterDataTypePreferredPref(
127 syncable::ModelType type, bool is_preferred); 127 syncer::ModelType type, bool is_preferred);
128 bool GetDataTypePreferred(syncable::ModelType type) const; 128 bool GetDataTypePreferred(syncer::ModelType type) const;
129 void SetDataTypePreferred(syncable::ModelType type, bool is_preferred); 129 void SetDataTypePreferred(syncer::ModelType type, bool is_preferred);
130 130
131 // Returns a ModelTypeSet based on |types| expanded to include pref groups 131 // Returns a ModelTypeSet based on |types| expanded to include pref groups
132 // (see |pref_groups_|), but as a subset of |registered_types|. 132 // (see |pref_groups_|), but as a subset of |registered_types|.
133 syncable::ModelTypeSet ResolvePrefGroups( 133 syncer::ModelTypeSet ResolvePrefGroups(
134 syncable::ModelTypeSet registered_types, 134 syncer::ModelTypeSet registered_types,
135 syncable::ModelTypeSet types) const; 135 syncer::ModelTypeSet types) const;
136 136
137 // May be NULL. 137 // May be NULL.
138 PrefService* const pref_service_; 138 PrefService* const pref_service_;
139 139
140 ObserverList<SyncPrefObserver> sync_pref_observers_; 140 ObserverList<SyncPrefObserver> sync_pref_observers_;
141 141
142 // The preference that controls whether sync is under control by 142 // The preference that controls whether sync is under control by
143 // configuration management. 143 // configuration management.
144 BooleanPrefMember pref_sync_managed_; 144 BooleanPrefMember pref_sync_managed_;
145 145
146 // Groups of prefs that always have the same value as a "master" pref. 146 // Groups of prefs that always have the same value as a "master" pref.
147 // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS} 147 // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS}
148 // (as well as APPS, but that is implied), so 148 // (as well as APPS, but that is implied), so
149 // pref_groups_[syncable::APPS] = { syncable::APP_NOTIFICATIONS, 149 // pref_groups_[syncer::APPS] = { syncer::APP_NOTIFICATIONS,
150 // syncable::APP_SETTINGS } 150 // syncer::APP_SETTINGS }
151 // pref_groups_[syncable::EXTENSIONS] = { syncable::EXTENSION_SETTINGS } 151 // pref_groups_[syncer::EXTENSIONS] = { syncer::EXTENSION_SETTINGS }
152 // etc. 152 // etc.
153 typedef std::map<syncable::ModelType, syncable::ModelTypeSet> PrefGroupsMap; 153 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap;
154 PrefGroupsMap pref_groups_; 154 PrefGroupsMap pref_groups_;
155 155
156 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); 156 DISALLOW_COPY_AND_ASSIGN(SyncPrefs);
157 }; 157 };
158 158
159 } // namespace browser_sync 159 } // namespace browser_sync
160 160
161 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ 161 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | chrome/browser/sync/sync_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698