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

Unified Diff: components/sync/syncable/model_type.cc

Issue 2859033002: [sync] Add constexpr to EnumSet (Closed)
Patch Set: Move reading list switches and buildflag to /features Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/syncable/DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/syncable/model_type.cc
diff --git a/components/sync/syncable/model_type.cc b/components/sync/syncable/model_type.cc
index 0a924fd5ce54c0b3b9ad5c508947316a9a80b50d..20f556d0ef9402d717961f78435c837f362a2980 100644
--- a/components/sync/syncable/model_type.cc
+++ b/components/sync/syncable/model_type.cc
@@ -10,7 +10,6 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string_split.h"
#include "base/values.h"
-#include "components/reading_list/core/reading_list_enable_flags.h"
#include "components/sync/protocol/app_notification_specifics.pb.h"
#include "components/sync/protocol/app_setting_specifics.pb.h"
#include "components/sync/protocol/app_specifics.pb.h"
@@ -152,20 +151,6 @@ const ModelTypeInfo kModelTypeInfoMap[] = {
static_assert(arraysize(kModelTypeInfoMap) == MODEL_TYPE_COUNT,
"kModelTypeInfoMap should have MODEL_TYPE_COUNT elements");
-// Notes:
-// 1) This list must contain exactly the same elements as the set returned by
-// UserSelectableTypes().
-// 2) This list must be in the same order as the respective values in the
-// ModelType enum.
-const char* kUserSelectableDataTypeNames[] = {
- "bookmarks", "preferences", "passwords", "autofill",
- "themes", "typedUrls", "extensions", "apps",
-#if BUILDFLAG(ENABLE_READING_LIST)
- "readingList",
-#endif
- "tabs",
-};
-
void AddDefaultFieldValue(ModelType type, sync_pb::EntitySpecifics* specifics) {
switch (type) {
case UNSPECIFIED:
@@ -426,29 +411,6 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
return UNSPECIFIED;
}
-ModelTypeSet ProtocolTypes() {
- return Difference(ModelTypeSet::All(), ProxyTypes());
-}
-
-ModelTypeSet UserTypes() {
- // TODO(sync): We should be able to build the actual enumset's internal
- // bitset value here at compile time, instead of makes a new one each time.
- return ModelTypeSet::FromRange(FIRST_USER_MODEL_TYPE, LAST_USER_MODEL_TYPE);
-}
-
-ModelTypeSet UserSelectableTypes() {
- return ModelTypeSet(BOOKMARKS, PREFERENCES, PASSWORDS, AUTOFILL, THEMES,
- TYPED_URLS, EXTENSIONS, APPS,
-#if BUILDFLAG(ENABLE_READING_LIST)
- READING_LIST,
-#endif
- PROXY_TABS);
-}
-
-bool IsUserSelectableType(ModelType model_type) {
- return UserSelectableTypes().Has(model_type);
-}
-
ModelTypeNameMap GetUserSelectableTypeNameMap() {
ModelTypeNameMap type_names;
ModelTypeSet type_set = UserSelectableTypes();
@@ -500,51 +462,6 @@ ModelTypeSet EncryptableUserTypes() {
return encryptable_user_types;
}
-ModelTypeSet PriorityUserTypes() {
- return ModelTypeSet(DEVICE_INFO, PRIORITY_PREFERENCES);
-}
-
-ModelTypeSet ControlTypes() {
- // TODO(sync): We should be able to build the actual enumset's internal
- // bitset value here at compile time, instead of makes a new one each time.
- return ModelTypeSet::FromRange(FIRST_CONTROL_MODEL_TYPE,
- LAST_CONTROL_MODEL_TYPE);
-}
-
-ModelTypeSet ProxyTypes() {
- return ModelTypeSet::FromRange(FIRST_PROXY_TYPE, LAST_PROXY_TYPE);
-}
-
-bool IsControlType(ModelType model_type) {
- return ControlTypes().Has(model_type);
-}
-
-ModelTypeSet CoreTypes() {
- ModelTypeSet result = PriorityCoreTypes();
-
- // The following are low priority core types.
- result.Put(SYNCED_NOTIFICATIONS);
- result.Put(SYNCED_NOTIFICATION_APP_INFO);
- result.Put(SUPERVISED_USER_SHARED_SETTINGS);
- result.Put(SUPERVISED_USER_WHITELISTS);
-
- return result;
-}
-
-ModelTypeSet PriorityCoreTypes() {
- ModelTypeSet result = ControlTypes();
-
- // The following are non-control core types.
- result.Put(SUPERVISED_USERS);
- result.Put(SUPERVISED_USER_SETTINGS);
-
- return result;
-}
-
-ModelTypeSet CommitOnlyTypes() {
- return ModelTypeSet(USER_EVENTS);
-}
-
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
« no previous file with comments | « components/sync/syncable/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698