diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-18 03:53:24 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-18 03:53:24 +0000 |
commit | d516cec346677c1edebb005f24ac1c0cde53686f (patch) | |
tree | a0385c59130e38cef0bc539ba302d34ddff9a059 /sync | |
parent | 741b407554eebbc634679ee730d1f033958fa682 (diff) | |
download | chromium_src-d516cec346677c1edebb005f24ac1c0cde53686f.zip chromium_src-d516cec346677c1edebb005f24ac1c0cde53686f.tar.gz chromium_src-d516cec346677c1edebb005f24ac1c0cde53686f.tar.bz2 |
[Sync] Add CoreTypes support
Previously we manually added "always enable" types from within the DataTypeManager.
Now the notion of types to always enable is pulled into its own construct, CoreTypes
(and it's sibling PriorityCoreTypes). Tests have been updated to exercise this, and
SyncedNotifications has been added as the first Core type.
BUG=245762
Review URL: https://chromiumcodereview.appspot.com/19227004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/internal_api/public/base/model_type.h | 8 | ||||
-rw-r--r-- | sync/syncable/model_type.cc | 24 |
2 files changed, 30 insertions, 2 deletions
diff --git a/sync/internal_api/public/base/model_type.h b/sync/internal_api/public/base/model_type.h index 59f970f..247d351 100644 --- a/sync/internal_api/public/base/model_type.h +++ b/sync/internal_api/public/base/model_type.h @@ -207,6 +207,14 @@ SYNC_EXPORT ModelTypeSet ControlTypes(); // See comment above for more information on what makes these types special. SYNC_EXPORT bool IsControlType(ModelType model_type); +// Core types are those data types used by sync's core functionality (i.e. not +// user data types). These types are always enabled, and include ControlTypes(). +// +// The set of all core types. +SYNC_EXPORT ModelTypeSet CoreTypes(); +// Those core types that have high priority (includes ControlTypes()). +SYNC_EXPORT ModelTypeSet PriorityCoreTypes(); + // Determine a model type from the field number of its associated // EntitySpecifics field. Returns UNSPECIFIED if the field number is // not recognized. diff --git a/sync/syncable/model_type.cc b/sync/syncable/model_type.cc index 5e22794..b9dacbe 100644 --- a/sync/syncable/model_type.cc +++ b/sync/syncable/model_type.cc @@ -367,7 +367,7 @@ ModelTypeSet EncryptableUserTypes() { encryptable_user_types.Remove(SYNCED_NOTIFICATIONS); // Priority preferences are not encrypted because they might be synced before // encryption is ready. - encryptable_user_types.RemoveAll(PriorityUserTypes()); + encryptable_user_types.Remove(PRIORITY_PREFERENCES); // Managed user settings are not encrypted since they are set server-side. encryptable_user_types.Remove(MANAGED_USER_SETTINGS); // Managed users are not encrypted since they are managed server-side. @@ -380,7 +380,7 @@ ModelTypeSet EncryptableUserTypes() { } ModelTypeSet PriorityUserTypes() { - return ModelTypeSet(PRIORITY_PREFERENCES, MANAGED_USERS); + return ModelTypeSet(PRIORITY_PREFERENCES); } ModelTypeSet ControlTypes() { @@ -405,6 +405,26 @@ bool IsControlType(ModelType model_type) { return ControlTypes().Has(model_type); } +ModelTypeSet CoreTypes() { + syncer::ModelTypeSet result; + result.PutAll(PriorityCoreTypes()); + + // The following are low priority core types. + result.Put(SYNCED_NOTIFICATIONS); + + return result; +} + +ModelTypeSet PriorityCoreTypes() { + syncer::ModelTypeSet result; + result.PutAll(ControlTypes()); + + // The following are non-control core types. + result.Put(MANAGED_USERS); + + return result; +} + const char* ModelTypeToString(ModelType model_type) { // This is used in serialization routines as well as for displaying debug // information. Do not attempt to change these string values unless you know |