From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Mon, 21 Feb 2022 01:24:11 +0100 Subject: Allow building without supervised users License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- chrome/android/BUILD.gn | 1 - .../chrome/browser/feedback/ChromeFeedbackCollector.java | 1 - chrome/browser/feedback/android/BUILD.gn | 2 -- chrome/browser/prefs/chrome_pref_service_factory.cc | 2 +- chrome/browser/profiles/profile_attributes_entry.cc | 2 +- chrome/browser/profiles/profile_impl.cc | 5 +---- chrome/browser/profiles/profile_manager.cc | 7 ------- chrome/browser/ui/webui/managed_ui_handler.cc | 4 ---- .../browser/ui/webui/management/management_ui_handler.cc | 4 ---- .../core/browser/supervised_user_pref_store.cc | 1 + .../core/browser/supervised_user_preferences.cc | 6 +++++- .../core/browser/supervised_user_service.cc | 5 +---- .../supervised_user/core/browser/supervised_user_utils.cc | 1 + components/supervised_user/core/common/features.cc | 6 ++++++ 14 files changed, 17 insertions(+), 30 deletions(-) diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -794,7 +794,6 @@ if (current_toolchain == default_toolchain) { "//components/offline_pages/core:offline_page_model_enums_java", "//components/sharing_message:sharing_dialog_type_generated_enum", "//components/sharing_message:sharing_send_message_result_generated_enum", - "//components/supervised_user/core/browser:supervised_user_utils_enum_javagen", ] # From java_sources.gni. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/feedback/ChromeFeedbackCollector.java b/chrome/android/java/src/org/chromium/chrome/browser/feedback/ChromeFeedbackCollector.java --- a/chrome/android/java/src/org/chromium/chrome/browser/feedback/ChromeFeedbackCollector.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/feedback/ChromeFeedbackCollector.java @@ -91,7 +91,6 @@ public class ChromeFeedbackCollector extends FeedbackCollectorSetManagedPolicies(policy_service, policy_connector); factory->SetRecommendedPolicies(policy_service, policy_connector); - if (supervised_user_settings) { + if (((false)) && supervised_user_settings) { scoped_refptr supervised_user_prefs = base::MakeRefCounted(supervised_user_settings); DCHECK(async || supervised_user_prefs->IsInitializationComplete()); diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc --- a/chrome/browser/profiles/profile_attributes_entry.cc +++ b/chrome/browser/profiles/profile_attributes_entry.cc @@ -454,7 +454,7 @@ bool ProfileAttributesEntry::IsSigninRequired() const { } std::string ProfileAttributesEntry::GetSupervisedUserId() const { - return GetString(kSupervisedUserId); + return ""; } bool ProfileAttributesEntry::IsEphemeral() const { diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -697,10 +697,6 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) { prefs->SetTime(prefs::kProfileCreationTime, path_creation_time_); pref_change_registrar_.Init(prefs); - pref_change_registrar_.Add( - prefs::kSupervisedUserId, - base::BindRepeating(&ProfileImpl::UpdateSupervisedUserIdInStorage, - base::Unretained(this))); // Changes in the profile avatar. pref_change_registrar_.Add( @@ -1640,6 +1636,7 @@ GURL ProfileImpl::GetHomePage() { } void ProfileImpl::UpdateSupervisedUserIdInStorage() { + if ((true)) return; ProfileManager* profile_manager = g_browser_process->profile_manager(); ProfileAttributesEntry* entry = profile_manager->GetProfileAttributesStorage() .GetProfileAttributesWithPath(GetPath()); diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc @@ -1221,10 +1221,6 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) { profile->GetPrefs()->SetString(prefs::kProfileName, profile_name); } - if (!profile->GetPrefs()->HasPrefPath(prefs::kSupervisedUserId)) { - profile->GetPrefs()->SetString(prefs::kSupervisedUserId, - supervised_user_id); - } #if !BUILDFLAG(IS_ANDROID) if (profile->IsNewProfile()) { profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, false); @@ -2026,9 +2022,6 @@ void ProfileManager::AddProfileToStorage(Profile* profile) { init_params.icon_index = profile->GetPrefs()->GetInteger(prefs::kProfileAvatarIndex); - init_params.supervised_user_id = - profile->GetPrefs()->GetString(prefs::kSupervisedUserId); - #if BUILDFLAG(IS_CHROMEOS_ASH) user_manager::User* user = ash::ProfileHelper::Get()->GetUserByProfile(profile); diff --git a/chrome/browser/ui/webui/managed_ui_handler.cc b/chrome/browser/ui/webui/managed_ui_handler.cc --- a/chrome/browser/ui/webui/managed_ui_handler.cc +++ b/chrome/browser/ui/webui/managed_ui_handler.cc @@ -89,10 +89,6 @@ void ManagedUIHandler::AddObservers() { auto domain = static_cast(i); policy_service->AddObserver(domain, this); } - - pref_registrar_.Add(prefs::kSupervisedUserId, - base::BindRepeating(&ManagedUIHandler::NotifyIfChanged, - base::Unretained(this))); } void ManagedUIHandler::RemoveObservers() { diff --git a/chrome/browser/ui/webui/management/management_ui_handler.cc b/chrome/browser/ui/webui/management/management_ui_handler.cc --- a/chrome/browser/ui/webui/management/management_ui_handler.cc +++ b/chrome/browser/ui/webui/management/management_ui_handler.cc @@ -571,10 +571,6 @@ bool ManagementUIHandler::managed() const { void ManagementUIHandler::RegisterPrefChange( PrefChangeRegistrar& pref_registrar) { - pref_registrar_.Add( - prefs::kSupervisedUserId, - base::BindRepeating(&ManagementUIHandler::UpdateManagedState, - base::Unretained(this))); } void ManagementUIHandler::UpdateManagedState() { diff --git a/components/supervised_user/core/browser/supervised_user_pref_store.cc b/components/supervised_user/core/browser/supervised_user_pref_store.cc --- a/components/supervised_user/core/browser/supervised_user_pref_store.cc +++ b/components/supervised_user/core/browser/supervised_user_pref_store.cc @@ -126,6 +126,7 @@ SupervisedUserPrefStore::~SupervisedUserPrefStore() {} void SupervisedUserPrefStore::OnNewSettingsAvailable( const base::Value::Dict& settings) { + if ((true)) return; std::unique_ptr old_prefs = std::move(prefs_); prefs_ = std::make_unique(); if (!settings.empty()) { diff --git a/components/supervised_user/core/browser/supervised_user_preferences.cc b/components/supervised_user/core/browser/supervised_user_preferences.cc --- a/components/supervised_user/core/browser/supervised_user_preferences.cc +++ b/components/supervised_user/core/browser/supervised_user_preferences.cc @@ -158,6 +158,10 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { } void EnableParentalControls(PrefService& pref_service) { + if ((true)) { + DisableParentalControls(pref_service); + return; + } pref_service.SetString(prefs::kSupervisedUserId, supervised_user::kChildAccountSUID); SetIsChildAccountStatusKnown(pref_service); @@ -180,7 +184,7 @@ bool IsSafeSitesEnabled(const PrefService& pref_service) { } bool IsSubjectToParentalControls(const PrefService& pref_service) { - return pref_service.GetString(prefs::kSupervisedUserId) == kChildAccountSUID; + return false; } } // namespace supervised_user diff --git a/components/supervised_user/core/browser/supervised_user_service.cc b/components/supervised_user/core/browser/supervised_user_service.cc --- a/components/supervised_user/core/browser/supervised_user_service.cc +++ b/components/supervised_user/core/browser/supervised_user_service.cc @@ -49,10 +49,6 @@ void SupervisedUserService::Init() { DCHECK(settings_service_->IsReady()); pref_change_registrar_.Init(&user_prefs_.get()); - pref_change_registrar_.Add( - prefs::kSupervisedUserId, - base::BindRepeating(&SupervisedUserService::OnSupervisedUserIdChanged, - base::Unretained(this))); FirstTimeInterstitialBannerState banner_state = static_cast( user_prefs_->GetInteger(prefs::kFirstTimeInterstitialBannerState)); @@ -166,6 +162,7 @@ FirstTimeInterstitialBannerState SupervisedUserService::GetUpdatedBannerState( } void SupervisedUserService::SetActive(bool active) { + active = false; if (active_ == active) { return; } diff --git a/components/supervised_user/core/browser/supervised_user_utils.cc b/components/supervised_user/core/browser/supervised_user_utils.cc --- a/components/supervised_user/core/browser/supervised_user_utils.cc +++ b/components/supervised_user/core/browser/supervised_user_utils.cc @@ -116,6 +116,7 @@ GURL NormalizeUrl(const GURL& url) { } bool AreWebFilterPrefsDefault(const PrefService& pref_service) { + if ((true)) return true; return pref_service .FindPreference(prefs::kDefaultSupervisedUserFilteringBehavior) ->IsDefaultValue() || diff --git a/components/supervised_user/core/common/features.cc b/components/supervised_user/core/common/features.cc --- a/components/supervised_user/core/common/features.cc +++ b/components/supervised_user/core/common/features.cc @@ -185,4 +185,10 @@ bool IsKidFriendlyContentFeedAvailable() { return base::FeatureList::IsEnabled(kKidFriendlyContentFeed); } +SET_CROMITE_FEATURE_DISABLED(kKidFriendlyContentFeed); +SET_CROMITE_FEATURE_DISABLED(kLocalWebApprovals); +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) +SET_CROMITE_FEATURE_DISABLED(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop); +#endif + } // namespace supervised_user --