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