Commit 863c0e74 authored by Aga Wronska's avatar Aga Wronska Committed by Chromium LUCI CQ

Deprecate SUPERVISED_USER_ALLOWLISTS sync data type

Content packs feature for supervised users has never been
launched - deprecate the code.

Bug: 1149788
Change-Id: Ifdb8db5d7c5c482d74c8419e74ef540a000b1fde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2551816
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833530}
parent 3e980d9a
......@@ -151,7 +151,7 @@ SupervisedUserAllowlistService::MergeDataAndStartSyncing(
const syncer::SyncDataList& initial_sync_data,
std::unique_ptr<syncer::SyncChangeProcessor> sync_processor,
std::unique_ptr<syncer::SyncErrorFactory> error_handler) {
DCHECK_EQ(syncer::SUPERVISED_USER_ALLOWLISTS, type);
DCHECK_EQ(syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS, type);
syncer::SyncChangeList change_list;
......@@ -160,7 +160,8 @@ SupervisedUserAllowlistService::MergeDataAndStartSyncing(
std::set<std::string> seen_ids;
for (const syncer::SyncData& sync_data : initial_sync_data) {
DCHECK_EQ(syncer::SUPERVISED_USER_ALLOWLISTS, sync_data.GetDataType());
DCHECK_EQ(syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS,
sync_data.GetDataType());
const sync_pb::ManagedUserWhitelistSpecifics& allowlist =
sync_data.GetSpecifics().managed_user_whitelist();
std::string id = allowlist.id();
......@@ -201,7 +202,7 @@ SupervisedUserAllowlistService::MergeDataAndStartSyncing(
}
void SupervisedUserAllowlistService::StopSyncing(syncer::ModelType type) {
DCHECK_EQ(syncer::SUPERVISED_USER_ALLOWLISTS, type);
DCHECK_EQ(syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS, type);
}
syncer::SyncDataList SupervisedUserAllowlistService::GetAllSyncDataForTesting(
......@@ -236,7 +237,8 @@ SupervisedUserAllowlistService::ProcessSyncChanges(
base::DictionaryValue* pref_dict = update.Get();
for (const syncer::SyncChange& sync_change : change_list) {
syncer::SyncData data = sync_change.sync_data();
DCHECK_EQ(syncer::SUPERVISED_USER_ALLOWLISTS, data.GetDataType());
DCHECK_EQ(syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS,
data.GetDataType());
const sync_pb::ManagedUserWhitelistSpecifics& allowlist =
data.GetSpecifics().managed_user_whitelist();
std::string id = allowlist.id();
......
......@@ -169,15 +169,17 @@ class SupervisedUserAllowlistServiceTest : public testing::Test {
TEST_F(SupervisedUserAllowlistServiceTest, MergeEmpty) {
service_->Init();
ASSERT_TRUE(
service_->GetAllSyncDataForTesting(syncer::SUPERVISED_USER_ALLOWLISTS)
ASSERT_TRUE(service_
->GetAllSyncDataForTesting(
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS)
.empty());
base::Optional<syncer::ModelError> error = service_->MergeDataAndStartSyncing(
syncer::SUPERVISED_USER_ALLOWLISTS, syncer::SyncDataList(),
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS, syncer::SyncDataList(),
std::unique_ptr<syncer::SyncChangeProcessor>(),
std::unique_ptr<syncer::SyncErrorFactory>());
EXPECT_TRUE(
service_->GetAllSyncDataForTesting(syncer::SUPERVISED_USER_ALLOWLISTS)
EXPECT_TRUE(service_
->GetAllSyncDataForTesting(
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS)
.empty());
EXPECT_FALSE(error.has_value());
......@@ -215,15 +217,17 @@ TEST_F(SupervisedUserAllowlistServiceTest, MergeExisting) {
initial_data.push_back(
SupervisedUserAllowlistService::CreateAllowlistSyncData("cccc",
"Allowlist C"));
ASSERT_EQ(
2u, service_->GetAllSyncDataForTesting(syncer::SUPERVISED_USER_ALLOWLISTS)
ASSERT_EQ(2u, service_
->GetAllSyncDataForTesting(
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS)
.size());
base::Optional<syncer::ModelError> error = service_->MergeDataAndStartSyncing(
syncer::SUPERVISED_USER_ALLOWLISTS, initial_data,
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS, initial_data,
std::unique_ptr<syncer::SyncChangeProcessor>(),
std::unique_ptr<syncer::SyncErrorFactory>());
EXPECT_EQ(
2u, service_->GetAllSyncDataForTesting(syncer::SUPERVISED_USER_ALLOWLISTS)
EXPECT_EQ(2u, service_
->GetAllSyncDataForTesting(
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS)
.size());
EXPECT_FALSE(error.has_value());
......
......@@ -22,7 +22,7 @@ SupervisedUserSyncModelTypeController::SupervisedUserSyncModelTypeController(
DelegateMode::kTransportModeWithSingleModel),
profile_(profile) {
DCHECK(type == syncer::SUPERVISED_USER_SETTINGS ||
type == syncer::SUPERVISED_USER_ALLOWLISTS);
type == syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS);
}
SupervisedUserSyncModelTypeController::
......
......@@ -383,9 +383,10 @@ ChromeSyncClient::CreateDataTypeControllers(syncer::SyncService* sync_service) {
model_type_store_factory,
GetSyncableServiceForType(syncer::SUPERVISED_USER_SETTINGS)));
controllers.push_back(std::make_unique<SupervisedUserSyncModelTypeController>(
syncer::SUPERVISED_USER_ALLOWLISTS, profile_, dump_stack,
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS, profile_, dump_stack,
model_type_store_factory,
GetSyncableServiceForType(syncer::SUPERVISED_USER_ALLOWLISTS)));
GetSyncableServiceForType(
syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS)));
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
#if BUILDFLAG(ENABLE_EXTENSIONS)
......@@ -610,7 +611,7 @@ ChromeSyncClient::GetSyncableServiceForType(syncer::ModelType type) {
return SupervisedUserSettingsServiceFactory::GetForKey(
profile_->GetProfileKey())
->AsWeakPtr();
case syncer::SUPERVISED_USER_ALLOWLISTS:
case syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS:
return SupervisedUserServiceFactory::GetForProfile(profile_)
->GetAllowlistService()
->AsWeakPtr();
......
......@@ -92,7 +92,7 @@ class ProfileSyncServiceFactoryTest : public testing::Test {
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
datatypes.push_back(syncer::SUPERVISED_USER_SETTINGS);
datatypes.push_back(syncer::SUPERVISED_USER_ALLOWLISTS);
datatypes.push_back(syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS);
#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
#if BUILDFLAG(ENABLE_EXTENSIONS)
......
......@@ -110,7 +110,7 @@ class MigrationTest : public SyncTest {
// Supervised user data types will be "unready" during this test, so we
// should not request that they be migrated.
preferred_data_types.Remove(syncer::SUPERVISED_USER_SETTINGS);
preferred_data_types.Remove(syncer::SUPERVISED_USER_ALLOWLISTS);
preferred_data_types.Remove(syncer::DEPRECATED_SUPERVISED_USER_ALLOWLISTS);
// Autofill wallet will be unready during this test, so we should not
// request that it be migrated.
......
......@@ -24,11 +24,11 @@ EXCEPTION_MODEL_TYPES = [
'NIGORI', # Model type string is 'encryption keys'.
'SUPERVISED_USER_SETTINGS', # Root tag and model type string replace
# 'Supervised' with 'Managed'
'SUPERVISED_USER_ALLOWLISTS', # See previous.
# Deprecated types:
'DEPRECATED_FAVICON_IMAGES',
'DEPRECATED_FAVICON_TRACKING']
'DEPRECATED_FAVICON_TRACKING',
'DEPRECATED_SUPERVISED_USER_ALLOWLISTS']
# Root tags are used as prefixes when creating storage keys, so certain strings
# are blacklisted in order to prevent prefix collision.
......
......@@ -141,10 +141,10 @@ const ModelTypeInfo kModelTypeInfoMap[] = {
{APP_LIST, "APP_LIST", "app_list", "App List",
sync_pb::EntitySpecifics::kAppListFieldNumber,
ModelTypeForHistograms::kAppList},
{SUPERVISED_USER_ALLOWLISTS, "MANAGED_USER_WHITELIST",
{DEPRECATED_SUPERVISED_USER_ALLOWLISTS, "MANAGED_USER_WHITELIST",
"managed_user_whitelists", "Managed User Whitelists",
sync_pb::EntitySpecifics::kManagedUserWhitelistFieldNumber,
ModelTypeForHistograms::kSupervisedUserAllowlists},
ModelTypeForHistograms::kDeprecatedSupervisedUserAllowlists},
{ARC_PACKAGE, "ARC_PACKAGE", "arc_package", "Arc Package",
sync_pb::EntitySpecifics::kArcPackageFieldNumber,
ModelTypeForHistograms::kArcPackage},
......@@ -280,7 +280,7 @@ void AddDefaultFieldValue(ModelType type, sync_pb::EntitySpecifics* specifics) {
case APP_LIST:
specifics->mutable_app_list();
break;
case SUPERVISED_USER_ALLOWLISTS:
case DEPRECATED_SUPERVISED_USER_ALLOWLISTS:
specifics->mutable_managed_user_whitelist();
break;
case ARC_PACKAGE:
......@@ -417,7 +417,7 @@ ModelType GetModelTypeFromSpecifics(const sync_pb::EntitySpecifics& specifics) {
if (specifics.has_app_list())
return APP_LIST;
if (specifics.has_managed_user_whitelist())
return SUPERVISED_USER_ALLOWLISTS;
return DEPRECATED_SUPERVISED_USER_ALLOWLISTS;
if (specifics.has_arc_package())
return ARC_PACKAGE;
if (specifics.has_printer())
......@@ -467,7 +467,7 @@ ModelTypeSet EncryptableUserTypes() {
encryptable_user_types.Remove(PRIORITY_PREFERENCES);
encryptable_user_types.Remove(OS_PRIORITY_PREFERENCES);
encryptable_user_types.Remove(SUPERVISED_USER_SETTINGS);
encryptable_user_types.Remove(SUPERVISED_USER_ALLOWLISTS);
encryptable_user_types.Remove(DEPRECATED_SUPERVISED_USER_ALLOWLISTS);
// Proxy types have no sync representation and are therefore not encrypted.
// Note however that proxy types map to one or more protocol types, which
// may or may not be encrypted themselves.
......
......@@ -112,7 +112,8 @@ enum ModelType {
APP_LIST,
// Supervised user allowlists. Each item contains a CRX ID (like an extension
// ID) and a name.
SUPERVISED_USER_ALLOWLISTS,
// TODO(crbug.com/1155257): Remove the deprecated type.
DEPRECATED_SUPERVISED_USER_ALLOWLISTS,
// ARC package items, i.e. Android apps on ChromeOS.
ARC_PACKAGE,
// Printer device information. ChromeOS only.
......@@ -212,7 +213,7 @@ enum class ModelTypeForHistograms {
// kDeprecatedSupervisedUserSharedSettings = 30,
// kDeprecatedSyncedNotificationAppInfo = 31,
// kDeprecatedWifiCredentials = 32,
kSupervisedUserAllowlists = 33,
kDeprecatedSupervisedUserAllowlists = 33,
kAutofillWalletData = 34,
kAutofillWalletMetadata = 35,
kArcPackage = 36,
......@@ -257,10 +258,10 @@ constexpr ModelTypeSet ProtocolTypes() {
APP_SETTINGS, EXTENSION_SETTINGS, HISTORY_DELETE_DIRECTIVES, DICTIONARY,
DEPRECATED_FAVICON_IMAGES, DEPRECATED_FAVICON_TRACKING, DEVICE_INFO,
PRIORITY_PREFERENCES, SUPERVISED_USER_SETTINGS, APP_LIST,
SUPERVISED_USER_ALLOWLISTS, ARC_PACKAGE, PRINTERS, READING_LIST,
USER_EVENTS, NIGORI, USER_CONSENTS, SEND_TAB_TO_SELF, SECURITY_EVENTS,
WEB_APPS, WIFI_CONFIGURATIONS, OS_PREFERENCES, OS_PRIORITY_PREFERENCES,
SHARING_MESSAGE);
DEPRECATED_SUPERVISED_USER_ALLOWLISTS, ARC_PACKAGE, PRINTERS,
READING_LIST, USER_EVENTS, NIGORI, USER_CONSENTS, SEND_TAB_TO_SELF,
SECURITY_EVENTS, WEB_APPS, WIFI_CONFIGURATIONS, OS_PREFERENCES,
OS_PRIORITY_PREFERENCES, SHARING_MESSAGE);
}
// These are the normal user-controlled types. This is to distinguish from
......@@ -273,8 +274,8 @@ constexpr ModelTypeSet UserTypes() {
// User types, which are not user-controlled.
constexpr ModelTypeSet AlwaysPreferredUserTypes() {
return ModelTypeSet(DEVICE_INFO, USER_CONSENTS, SECURITY_EVENTS,
SUPERVISED_USER_SETTINGS, SUPERVISED_USER_ALLOWLISTS,
SHARING_MESSAGE);
SUPERVISED_USER_SETTINGS,
DEPRECATED_SUPERVISED_USER_ALLOWLISTS, SHARING_MESSAGE);
}
// User types which are always encrypted.
......@@ -297,7 +298,7 @@ constexpr ModelTypeSet PriorityUserTypes() {
DEVICE_INFO, SHARING_MESSAGE,
// For supervised users, it is important to quickly deliver changes in
// settings and in allowed sites to the supervised user.
SUPERVISED_USER_SETTINGS, SUPERVISED_USER_ALLOWLISTS,
SUPERVISED_USER_SETTINGS, DEPRECATED_SUPERVISED_USER_ALLOWLISTS,
// These are by definition preferences for which it is important that the
// client picks them up quickly (also because these can get changed
// server-side). For example, such a pref could control whether a
......
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