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 ------- .../supervised_user/supervised_user_browser_utils.cc | 1 + 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 | 1 + components/supervised_user/core/common/features.cc | 3 ++- extensions/browser/api/management/management_api.cc | 1 + 15 files changed, 14 insertions(+), 27 deletions(-) diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn @@ -815,7 +815,6 @@ if (_is_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", "//components/touch_to_search/core/browser:quick_action_category_enum_javagen", ] 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 @@ -95,7 +95,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) { // supervised_user_prefs handles the case when content_filters_service is // nullptr. It's simply not subscribing to empty service's notifications. scoped_refptr supervised_user_prefs = 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 @@ -476,7 +476,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 @@ -679,10 +679,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( @@ -1603,6 +1599,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 @@ -1262,10 +1262,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); - } } void ProfileManager::RegisterTestingProfile(std::unique_ptr profile, @@ -2044,9 +2040,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) user_manager::User* user = ash::ProfileHelper::Get()->GetUserByProfile(profile); diff --git a/chrome/browser/supervised_user/supervised_user_browser_utils.cc b/chrome/browser/supervised_user/supervised_user_browser_utils.cc --- a/chrome/browser/supervised_user/supervised_user_browser_utils.cc +++ b/chrome/browser/supervised_user/supervised_user_browser_utils.cc @@ -98,6 +98,7 @@ bool SupervisedUserCanSkipExtensionParentApprovals(const Profile* profile) { } bool AreExtensionsPermissionsEnabled(Profile* profile) { + if ((true)) return false; #if BUILDFLAG(ENABLE_EXTENSIONS_CORE) return profile->IsChild(); #else 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 @@ -623,10 +623,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 @@ -172,6 +172,7 @@ void SupervisedUserPrefStore::OnNewContentFiltersStateAvailable( 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 @@ -160,6 +160,10 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { } void EnableParentalControls(PrefService& pref_service) { + if ((true)) { + DisableParentalControls(pref_service); + return; + } pref_service.SetString(prefs::kSupervisedUserId, supervised_user::kChildAccountSUID); #if BUILDFLAG(IS_CHROMEOS) @@ -187,7 +191,7 @@ bool IsSafeSitesEnabled(const PrefService& pref_service) { } bool IsSubjectToParentalControls(const PrefService& pref_service) { - return pref_service.GetString(prefs::kSupervisedUserId) == kChildAccountSUID; + return false; } bool IsGoogleSafeSearchEnforced(const PrefService& pref_service) { 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 @@ -244,6 +244,7 @@ SupervisedUserService::SupervisedUserService( } void SupervisedUserService::SetSettingsServiceActive(bool active) { + active = false; settings_service_->SetActive(active); // Trigger a sync reconfig to enable/disable the right SU data types. 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 @@ -30,7 +30,6 @@ BASE_FEATURE(kAllowSubframeLocalWebApprovals, #else base::FEATURE_DISABLED_BY_DEFAULT); #endif - #if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_WIN) const int kLocalWebApprovalBottomSheetLoadTimeoutDefaultValueMs = 5000; @@ -116,6 +115,7 @@ const base::FeatureParam namespace { bool PlatformSupportsLocalSupervision() { + if ((true)) return false; int32_t major, minor, bugfix; base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); bool supported_by_os = (major == 16 && minor >= 1) || major > 16; @@ -151,4 +151,5 @@ bool ClassifyUrlWithoutCredentialsForLocalSupervision() { #endif +SET_CROMITE_FEATURE_DISABLED(kLocalWebApprovals); } // namespace supervised_user diff --git a/extensions/browser/api/management/management_api.cc b/extensions/browser/api/management/management_api.cc --- a/extensions/browser/api/management/management_api.cc +++ b/extensions/browser/api/management/management_api.cc @@ -324,6 +324,7 @@ void AddExtensionInfo(const Extension* source_extension, } bool PlatformSupportsApprovalFlowForExtensions() { + if ((true)) return false; #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_WIN) return true; --