Files
cromite/build/patches/Allow-building-without-supervised-users.patch
T

261 lines
12 KiB
Diff

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 -
.../browser/feed/FeedSurfaceCoordinator.java | 5 +----
chrome/browser/BUILD.gn | 2 --
.../prefs/chrome_pref_service_factory.cc | 2 +-
.../profiles/profile_attributes_entry.cc | 2 +-
chrome/browser/profiles/profile_impl.cc | 5 +----
chrome/browser/profiles/profile_manager.cc | 20 -------------------
chrome/browser/ui/webui/managed_ui_handler.cc | 4 ----
.../webui/management/management_ui_handler.cc | 4 ----
.../browser/supervised_user_pref_store.cc | 1 +
.../browser/supervised_user_preferences.cc | 6 +++++-
.../core/browser/supervised_user_service.cc | 5 +----
.../core/browser/supervised_user_utils.cc | 1 +
.../supervised_user/core/common/features.cc | 6 ++++++
14 files changed, 18 insertions(+), 46 deletions(-)
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -754,7 +754,6 @@ if (current_toolchain == default_toolchain) {
"//components/dom_distiller/core:distiller_type_java",
"//components/ntp_tiles:ntp_tiles_enums_java",
"//components/offline_pages/core:offline_page_model_enums_java",
- "//components/supervised_user/core/browser:supervised_user_utils_enum_javagen",
"//net:effective_connection_type_java",
]
diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java
--- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java
+++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/FeedSurfaceCoordinator.java
@@ -69,7 +69,6 @@ import org.chromium.components.browser_ui.widget.displaystyle.UiConfig;
import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.components.feature_engagement.Tracker;
import org.chromium.components.prefs.PrefService;
-import org.chromium.components.supervised_user.SupervisedUserPreferences;
import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.third_party.android.swiperefresh.SwipeRefreshLayout;
import org.chromium.ui.base.DeviceFormFactor;
@@ -793,9 +792,7 @@ public class FeedSurfaceCoordinator
* Returns true if the supervised user feed should be displayed.
*/
public boolean shouldDisplaySupervisedFeed() {
- PrefService prefService = UserPrefs.get(mProfile);
- return SupervisedUserPreferences.isSubjectToParentalControls(prefService)
- && ChromeFeatureList.isEnabled(ChromeFeatureList.KID_FRIENDLY_CONTENT_FEED);
+ return false;
}
/**
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -3286,8 +3286,6 @@ static_library("browser") {
"feed/android/refresh_task_scheduler_impl.cc",
"feed/android/refresh_task_scheduler_impl.h",
"feed/android/web_feed_bridge.cc",
- "feedback/android/family_info_feedback_source.cc",
- "feedback/android/family_info_feedback_source.h",
"file_select_helper_contacts_android.cc",
"file_select_helper_contacts_android.h",
"first_run/android/first_run_prefs.cc",
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -320,7 +320,7 @@ void PrepareFactory(
policy::BrowserPolicyConnector* policy_connector) {
factory->SetManagedPolicies(policy_service, policy_connector);
factory->SetRecommendedPolicies(policy_service, policy_connector);
- if (supervised_user_settings) {
+ if (((false)) && supervised_user_settings) {
scoped_refptr<PrefStore> supervised_user_prefs =
base::MakeRefCounted<SupervisedUserPrefStore>(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
@@ -422,7 +422,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
@@ -690,10 +690,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(
@@ -1628,6 +1624,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
@@ -1213,23 +1213,6 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
profile->GetPrefs()->SetString(prefs::kProfileName, profile_name);
}
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- bool force_supervised_user_id =
-#if BUILDFLAG(IS_CHROMEOS_ASH)
- !ash::IsSigninBrowserContext(profile) &&
- !ash::IsLockScreenAppBrowserContext(profile) &&
-#endif
- command_line->HasSwitch(switches::kSupervisedUserId);
-
- if (force_supervised_user_id) {
- supervised_user_id =
- command_line->GetSwitchValueASCII(switches::kSupervisedUserId);
- }
- if (force_supervised_user_id ||
- !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);
@@ -2037,9 +2020,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<policy::PolicyDomain>(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
@@ -546,10 +546,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<PrefValueMap> old_prefs = std::move(prefs_);
prefs_ = std::make_unique<PrefValueMap>();
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
@@ -164,6 +164,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);
@@ -186,7 +190,7 @@ bool IsSafeSitesEnabled(const PrefService& pref_service) {
}
bool IsSubjectToParentalControls(const PrefService& pref_service) {
- return pref_service.GetString(prefs::kSupervisedUserId) == kChildAccountSUID;
+ return false;
}
bool AreExtensionsPermissionsEnabled(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
@@ -48,10 +48,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<FirstTimeInterstitialBannerState>(
user_prefs_->GetInteger(prefs::kFirstTimeInterstitialBannerState));
@@ -189,6 +185,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
@@ -119,6 +119,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
@@ -115,4 +115,10 @@ bool IsShadowKidsApiWithSafeSitesEnabled() {
return base::FeatureList::IsEnabled(kShadowKidsApiWithSafeSites);
}
+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
--