Commit 4026ebc5 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Mark synced notifications type as deprecated

These ancient sync types haven't been used for years and deprecated in
2014 with https://codereview.chromium.org/780363003.

We now rename the enum to prevent accidental references, and remove
some code leftovers that were effectively dead (e.g. type expansion
in SyncPrefs).

While doing this, we unify some strings in model_type.cc to avoid
prefix "Deprecated" in type names, which some types did, and instead
the presubmit checks are updated to whitelist deprecated datatypes and
allow their strings to be inconsistent.

Bug: 923826
Change-Id: Ib1d7b90042ef4598cc80d036cc50c3494eb170a6
Reviewed-on: https://chromium-review.googlesource.com/c/1454520
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629158}
parent 13f3d2ee
......@@ -992,7 +992,6 @@ syncer::ModelTypeSet SupervisedUserService::GetForcedDataTypes() const {
result.Put(syncer::EXTENSION_SETTINGS);
result.Put(syncer::APPS);
result.Put(syncer::APP_SETTINGS);
result.Put(syncer::APP_NOTIFICATIONS);
result.Put(syncer::APP_LIST);
return result;
}
......
......@@ -27,9 +27,12 @@ EXCEPTION_MODEL_TYPES = [
'SUPERVISED_USER_WHITELISTS', # See previous.
# Deprecated types:
'DEPRECATED_APP_NOTIFICATIONS',
'DEPRECATED_ARTICLES',
'DEPRECATED_SUPERVISED_USERS',
'DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS',
'DEPRECATED_ARTICLES',
'DEPRECATED_SYNCED_NOTIFICATIONS',
'DEPRECATED_SYNCED_NOTIFICATION_APP_INFO',
'DEPRECATED_WIFI_CREDENTIALS']
# Root tags are used as prefixes when creating storage keys, so certain strings
......
......@@ -92,16 +92,16 @@ void SyncWalletDataRecordClearedEntitiesCount(size_t count);
case ::syncer::EXTENSION_SETTINGS: \
PER_DATA_TYPE_MACRO("ExtensionSettings"); \
break; \
case ::syncer::APP_NOTIFICATIONS: \
case ::syncer::DEPRECATED_APP_NOTIFICATIONS: \
PER_DATA_TYPE_MACRO("AppNotifications"); \
break; \
case ::syncer::HISTORY_DELETE_DIRECTIVES: \
PER_DATA_TYPE_MACRO("HistoryDeleteDirectives"); \
break; \
case ::syncer::SYNCED_NOTIFICATIONS: \
case ::syncer::DEPRECATED_SYNCED_NOTIFICATIONS: \
PER_DATA_TYPE_MACRO("SyncedNotifications"); \
break; \
case ::syncer::SYNCED_NOTIFICATION_APP_INFO: \
case ::syncer::DEPRECATED_SYNCED_NOTIFICATION_APP_INFO: \
PER_DATA_TYPE_MACRO("SyncedNotificationAppInfo"); \
break; \
case ::syncer::DICTIONARY: \
......
......@@ -91,13 +91,13 @@ enum ModelType {
// An extension setting from the extension settings API.
EXTENSION_SETTINGS,
// App notifications. Deprecated.
APP_NOTIFICATIONS,
DEPRECATED_APP_NOTIFICATIONS,
// History delete directives.
HISTORY_DELETE_DIRECTIVES,
// Synced push notifications. Deprecated.
SYNCED_NOTIFICATIONS,
DEPRECATED_SYNCED_NOTIFICATIONS,
// Synced Notification app info. Deprecated.
SYNCED_NOTIFICATION_APP_INFO,
DEPRECATED_SYNCED_NOTIFICATION_APP_INFO,
// Custom spelling dictionary.
DICTIONARY,
// Favicon images.
......@@ -209,9 +209,10 @@ constexpr ModelTypeSet ProtocolTypes() {
BOOKMARKS, PREFERENCES, PASSWORDS, AUTOFILL_PROFILE, AUTOFILL,
AUTOFILL_WALLET_DATA, AUTOFILL_WALLET_METADATA, THEMES, TYPED_URLS,
EXTENSIONS, SEARCH_ENGINES, SESSIONS, APPS, APP_SETTINGS,
EXTENSION_SETTINGS, APP_NOTIFICATIONS, HISTORY_DELETE_DIRECTIVES,
SYNCED_NOTIFICATIONS, SYNCED_NOTIFICATION_APP_INFO, DICTIONARY,
FAVICON_IMAGES, FAVICON_TRACKING, DEVICE_INFO, PRIORITY_PREFERENCES,
EXTENSION_SETTINGS, DEPRECATED_APP_NOTIFICATIONS,
HISTORY_DELETE_DIRECTIVES, DEPRECATED_SYNCED_NOTIFICATIONS,
DEPRECATED_SYNCED_NOTIFICATION_APP_INFO, DICTIONARY, FAVICON_IMAGES,
FAVICON_TRACKING, DEVICE_INFO, PRIORITY_PREFERENCES,
SUPERVISED_USER_SETTINGS, DEPRECATED_SUPERVISED_USERS,
DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, DEPRECATED_ARTICLES, APP_LIST,
DEPRECATED_WIFI_CREDENTIALS, SUPERVISED_USER_WHITELISTS, ARC_PACKAGE,
......
......@@ -21,16 +21,14 @@ namespace syncer {
namespace {
// Groups of prefs that always have the same value as a "master" pref.
// For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS}
// For example, the APPS group has {APP_LIST, APP_SETTINGS}
// (as well as APPS, but that is implied), so
// pref_groups_[APPS] = { APP_NOTIFICATIONS,
// APP_SETTINGS }
// pref_groups_[APPS] = { APP_LIST, APP_SETTINGS }
// pref_groups_[EXTENSIONS] = { EXTENSION_SETTINGS }
// etc.
using PrefGroupsMap = std::map<ModelType, ModelTypeSet>;
PrefGroupsMap ComputePrefGroups() {
PrefGroupsMap pref_groups;
pref_groups[APPS].Put(APP_NOTIFICATIONS);
pref_groups[APPS].Put(APP_SETTINGS);
pref_groups[APPS].Put(APP_LIST);
pref_groups[APPS].Put(ARC_PACKAGE);
......@@ -380,10 +378,10 @@ const char* SyncPrefs::GetPrefNameForDataType(ModelType type) {
case SEARCH_ENGINES:
case APP_SETTINGS:
case EXTENSION_SETTINGS:
case APP_NOTIFICATIONS:
case DEPRECATED_APP_NOTIFICATIONS:
case HISTORY_DELETE_DIRECTIVES:
case SYNCED_NOTIFICATIONS:
case SYNCED_NOTIFICATION_APP_INFO:
case DEPRECATED_SYNCED_NOTIFICATIONS:
case DEPRECATED_SYNCED_NOTIFICATION_APP_INFO:
case DICTIONARY:
case FAVICON_IMAGES:
case FAVICON_TRACKING:
......
......@@ -257,7 +257,6 @@ TEST_F(SyncPrefsTest, PreferredTypesNotKeepEverythingSynced) {
}
if (type == APPS) {
expected_preferred_types.Put(APP_LIST);
expected_preferred_types.Put(APP_NOTIFICATIONS);
expected_preferred_types.Put(APP_SETTINGS);
expected_preferred_types.Put(ARC_PACKAGE);
}
......
......@@ -36,14 +36,14 @@ static const ModelType kStartOrder[] = {
// in parallel with the UI types.
PASSWORDS, AUTOFILL, AUTOFILL_PROFILE, AUTOFILL_WALLET_DATA,
AUTOFILL_WALLET_METADATA, EXTENSION_SETTINGS, APP_SETTINGS, TYPED_URLS,
HISTORY_DELETE_DIRECTIVES, SYNCED_NOTIFICATIONS,
SYNCED_NOTIFICATION_APP_INFO,
HISTORY_DELETE_DIRECTIVES, DEPRECATED_SYNCED_NOTIFICATIONS,
DEPRECATED_SYNCED_NOTIFICATION_APP_INFO,
// UI thread data types.
BOOKMARKS, PREFERENCES, PRIORITY_PREFERENCES, EXTENSIONS, APPS, APP_LIST,
ARC_PACKAGE, READING_LIST, THEMES, SEARCH_ENGINES, SESSIONS,
APP_NOTIFICATIONS, DICTIONARY, FAVICON_IMAGES, FAVICON_TRACKING, PRINTERS,
USER_CONSENTS, USER_EVENTS, SUPERVISED_USER_SETTINGS,
DEPRECATED_APP_NOTIFICATIONS, DICTIONARY, FAVICON_IMAGES, FAVICON_TRACKING,
PRINTERS, USER_CONSENTS, USER_EVENTS, SUPERVISED_USER_SETTINGS,
SUPERVISED_USER_WHITELISTS, DEPRECATED_WIFI_CREDENTIALS,
DEPRECATED_SUPERVISED_USERS, MOUNTAIN_SHARES,
DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, DEPRECATED_ARTICLES,
......
......@@ -52,10 +52,6 @@ message NigoriSpecifics {
// Passwords are always encrypted, so we don't need a field here.
// History delete directives need to be consumable by the server, and
// thus can't be encrypted.
// Synced Notifications need to be consumed by the server (the read flag)
// and thus can't be encrypted.
// Synced Notification App Info is set by the server, and thus cannot be
// encrypted.
optional bool encrypt_bookmarks = 13;
optional bool encrypt_preferences = 14;
optional bool encrypt_autofill_profile = 15;
......@@ -74,7 +70,7 @@ message NigoriSpecifics {
optional bool encrypt_everything = 24;
optional bool encrypt_extension_settings = 25;
optional bool encrypt_app_notifications = 26;
optional bool encrypt_app_notifications = 26 [deprecated = true];
optional bool encrypt_app_settings = 27;
// User device information. Contains information about each device that has a
......
......@@ -94,16 +94,16 @@ const ModelTypeInfo kModelTypeInfoMap[] = {
{EXTENSION_SETTINGS, "EXTENSION_SETTING", "extension_settings",
"Extension settings",
sync_pb::EntitySpecifics::kExtensionSettingFieldNumber, 14},
{APP_NOTIFICATIONS, "APP_NOTIFICATION", "app_notifications",
{DEPRECATED_APP_NOTIFICATIONS, "APP_NOTIFICATION", "app_notifications",
"App Notifications", sync_pb::EntitySpecifics::kAppNotificationFieldNumber,
15},
{HISTORY_DELETE_DIRECTIVES, "HISTORY_DELETE_DIRECTIVE",
"history_delete_directives", "History Delete Directives",
sync_pb::EntitySpecifics::kHistoryDeleteDirectiveFieldNumber, 16},
{SYNCED_NOTIFICATIONS, "SYNCED_NOTIFICATION", "synced_notifications",
"Synced Notifications",
{DEPRECATED_SYNCED_NOTIFICATIONS, "SYNCED_NOTIFICATION",
"synced_notifications", "Synced Notifications",
sync_pb::EntitySpecifics::kSyncedNotificationFieldNumber, 20},
{SYNCED_NOTIFICATION_APP_INFO, "SYNCED_NOTIFICATION_APP_INFO",
{DEPRECATED_SYNCED_NOTIFICATION_APP_INFO, "SYNCED_NOTIFICATION_APP_INFO",
"synced_notification_app_info", "Synced Notification App Info",
sync_pb::EntitySpecifics::kSyncedNotificationAppInfoFieldNumber, 31},
{DICTIONARY, "DICTIONARY", "dictionary", "Dictionary",
......@@ -126,8 +126,8 @@ const ModelTypeInfo kModelTypeInfoMap[] = {
{DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, "MANAGED_USER_SHARED_SETTING",
"managed_user_shared_settings", "Managed User Shared Settings",
sync_pb::EntitySpecifics::kManagedUserSharedSettingFieldNumber, 30},
{DEPRECATED_ARTICLES, "ARTICLE", "deprecated_articles",
"Deprecated Articles", sync_pb::EntitySpecifics::kArticleFieldNumber, 28},
{DEPRECATED_ARTICLES, "ARTICLE", "articles", "Articles",
sync_pb::EntitySpecifics::kArticleFieldNumber, 28},
{APP_LIST, "APP_LIST", "app_list", "App List",
sync_pb::EntitySpecifics::kAppListFieldNumber, 29},
{DEPRECATED_WIFI_CREDENTIALS, "WIFI_CREDENTIAL", "wifi_credentials",
......@@ -222,16 +222,16 @@ void AddDefaultFieldValue(ModelType type, sync_pb::EntitySpecifics* specifics) {
case EXTENSION_SETTINGS:
specifics->mutable_extension_setting();
break;
case APP_NOTIFICATIONS:
case DEPRECATED_APP_NOTIFICATIONS:
specifics->mutable_app_notification();
break;
case HISTORY_DELETE_DIRECTIVES:
specifics->mutable_history_delete_directive();
break;
case SYNCED_NOTIFICATIONS:
case DEPRECATED_SYNCED_NOTIFICATIONS:
specifics->mutable_synced_notification();
break;
case SYNCED_NOTIFICATION_APP_INFO:
case DEPRECATED_SYNCED_NOTIFICATION_APP_INFO:
specifics->mutable_synced_notification_app_info();
break;
case DICTIONARY:
......@@ -389,13 +389,13 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_extension_setting())
return EXTENSION_SETTINGS;
if (specifics.has_app_notification())
return APP_NOTIFICATIONS;
return DEPRECATED_APP_NOTIFICATIONS;
if (specifics.has_history_delete_directive())
return HISTORY_DELETE_DIRECTIVES;
if (specifics.has_synced_notification())
return SYNCED_NOTIFICATIONS;
return DEPRECATED_SYNCED_NOTIFICATIONS;
if (specifics.has_synced_notification_app_info())
return SYNCED_NOTIFICATION_APP_INFO;
return DEPRECATED_SYNCED_NOTIFICATION_APP_INFO;
if (specifics.has_dictionary())
return DICTIONARY;
if (specifics.has_favicon_image())
......@@ -465,10 +465,10 @@ ModelTypeSet EncryptableUserTypes() {
// We never encrypt history delete directives.
encryptable_user_types.Remove(HISTORY_DELETE_DIRECTIVES);
// Synced notifications are not encrypted since the server must see changes.
encryptable_user_types.Remove(SYNCED_NOTIFICATIONS);
encryptable_user_types.Remove(DEPRECATED_SYNCED_NOTIFICATIONS);
// Synced Notification App Info does not have private data, so it is not
// encrypted.
encryptable_user_types.Remove(SYNCED_NOTIFICATION_APP_INFO);
encryptable_user_types.Remove(DEPRECATED_SYNCED_NOTIFICATION_APP_INFO);
// Device info data is not encrypted because it might be synced before
// encryption is ready.
encryptable_user_types.Remove(DEVICE_INFO);
......
......@@ -263,7 +263,8 @@ void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types,
nigori->set_encrypt_app_settings(encrypted_types.Has(APP_SETTINGS));
nigori->set_encrypt_extension_settings(
encrypted_types.Has(EXTENSION_SETTINGS));
nigori->set_encrypt_app_notifications(encrypted_types.Has(APP_NOTIFICATIONS));
nigori->set_encrypt_app_notifications(
encrypted_types.Has(DEPRECATED_APP_NOTIFICATIONS));
nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY));
nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES));
nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING));
......@@ -311,7 +312,7 @@ ModelTypeSet GetEncryptedTypesFromNigori(
if (nigori.encrypt_extension_settings())
encrypted_types.Put(EXTENSION_SETTINGS);
if (nigori.encrypt_app_notifications())
encrypted_types.Put(APP_NOTIFICATIONS);
encrypted_types.Put(DEPRECATED_APP_NOTIFICATIONS);
if (nigori.encrypt_dictionary())
encrypted_types.Put(DICTIONARY);
if (nigori.encrypt_favicon_images())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment