292 lines
14 KiB
Diff
292 lines
14 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 -
|
|
chrome/android/chrome_java_sources.gni | 1 -
|
|
.../chrome/browser/feed/FeedSurfaceCoordinator.java | 5 +----
|
|
chrome/browser/BUILD.gn | 6 ------
|
|
.../browser/extensions/api/settings_private/prefs_util.cc | 2 ++
|
|
chrome/browser/profiles/profile_impl.cc | 4 ++++
|
|
chrome/browser/profiles/profile_manager.cc | 4 ++++
|
|
chrome/browser/ui/webui/managed_ui_handler.cc | 2 ++
|
|
chrome/browser/ui/webui/management/management_ui_handler.cc | 2 ++
|
|
components/supervised_user/buildflags.gni | 6 +-----
|
|
.../core/browser/supervised_user_preferences.cc | 2 +-
|
|
.../supervised_user/core/browser/supervised_user_utils.cc | 4 ++++
|
|
components/supervised_user/core/common/features.cc | 1 +
|
|
components/supervised_user/core/common/pref_names.h | 4 ++++
|
|
.../core/common/supervised_user_constants.cc | 2 ++
|
|
15 files changed, 28 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
|
--- a/chrome/android/BUILD.gn
|
|
+++ b/chrome/android/BUILD.gn
|
|
@@ -3697,7 +3697,6 @@ generate_jni("chrome_jni_headers") {
|
|
"java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java",
|
|
"java/src/org/chromium/chrome/browser/suggestions/mostvisited/MostVisitedSites.java",
|
|
"java/src/org/chromium/chrome/browser/suggestions/mostvisited/MostVisitedSitesBridge.java",
|
|
- "java/src/org/chromium/chrome/browser/supervised_user/ChildAccountService.java",
|
|
"java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java",
|
|
"java/src/org/chromium/chrome/browser/tab/TabBrowserControlsConstraintsHelper.java",
|
|
"java/src/org/chromium/chrome/browser/tab/TabFavicon.java",
|
|
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni
|
|
--- a/chrome/android/chrome_java_sources.gni
|
|
+++ b/chrome/android/chrome_java_sources.gni
|
|
@@ -1085,7 +1085,6 @@ chrome_java_sources = [
|
|
"java/src/org/chromium/chrome/browser/suggestions/tile/TileGroupDelegateImpl.java",
|
|
"java/src/org/chromium/chrome/browser/suggestions/tile/TileRenderer.java",
|
|
"java/src/org/chromium/chrome/browser/suggestions/tile/TopSitesTileView.java",
|
|
- "java/src/org/chromium/chrome/browser/supervised_user/ChildAccountService.java",
|
|
"java/src/org/chromium/chrome/browser/survey/ChromeSurveyController.java",
|
|
"java/src/org/chromium/chrome/browser/sync/SyncErrorNotifier.java",
|
|
"java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.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
|
|
@@ -68,7 +68,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;
|
|
@@ -775,9 +774,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
|
|
@@ -3165,8 +3165,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",
|
|
@@ -3371,10 +3369,6 @@ static_library("browser") {
|
|
"ssl/chrome_security_state_model_delegate.h",
|
|
"ssl/known_interception_disclosure_infobar.cc",
|
|
"ssl/known_interception_disclosure_infobar.h",
|
|
- "supervised_user/android/favicon_fetcher.cc",
|
|
- "supervised_user/android/favicon_fetcher.h",
|
|
- "supervised_user/android/supervised_user_web_content_handler_impl.cc",
|
|
- "supervised_user/android/supervised_user_web_content_handler_impl.h",
|
|
"sync/glue/synced_tab_delegate_android.cc",
|
|
"sync/glue/synced_tab_delegate_android.h",
|
|
"sync/glue/synced_window_delegate_android.cc",
|
|
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc
|
|
--- a/chrome/browser/extensions/api/settings_private/prefs_util.cc
|
|
+++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
|
|
@@ -1024,9 +1024,11 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() {
|
|
settings_api::PrefType::kBoolean;
|
|
#endif
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
// Supervised Users. This setting is queried in our Tast tests (b/241943380).
|
|
(*s_allowlist)[::prefs::kSupervisedUserExtensionsMayRequestPermissions] =
|
|
settings_api::PrefType::kBoolean;
|
|
+#endif
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
|
(*s_allowlist)[::prefs::kUseAshProxy] = settings_api::PrefType::kBoolean;
|
|
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
|
|
@@ -689,10 +689,12 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) {
|
|
prefs->SetTime(prefs::kProfileCreationTime, path_creation_time_);
|
|
|
|
pref_change_registrar_.Init(prefs);
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
pref_change_registrar_.Add(
|
|
prefs::kSupervisedUserId,
|
|
base::BindRepeating(&ProfileImpl::UpdateSupervisedUserIdInStorage,
|
|
base::Unretained(this)));
|
|
+#endif
|
|
|
|
// Changes in the profile avatar.
|
|
pref_change_registrar_.Add(
|
|
@@ -1627,11 +1629,13 @@ GURL ProfileImpl::GetHomePage() {
|
|
}
|
|
|
|
void ProfileImpl::UpdateSupervisedUserIdInStorage() {
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
ProfileManager* profile_manager = g_browser_process->profile_manager();
|
|
ProfileAttributesEntry* entry = profile_manager->GetProfileAttributesStorage()
|
|
.GetProfileAttributesWithPath(GetPath());
|
|
if (entry)
|
|
entry->SetSupervisedUserId(GetPrefs()->GetString(prefs::kSupervisedUserId));
|
|
+#endif
|
|
}
|
|
|
|
void ProfileImpl::UpdateNameInStorage() {
|
|
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
|
|
@@ -1215,6 +1215,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
|
|
profile->GetPrefs()->SetString(prefs::kProfileName, profile_name);
|
|
}
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
bool force_supervised_user_id =
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
@@ -1236,6 +1237,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
|
|
profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
|
|
supervised_user_id);
|
|
}
|
|
+#endif
|
|
#if !BUILDFLAG(IS_ANDROID)
|
|
if (profile->IsNewProfile()) {
|
|
profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, false);
|
|
@@ -2035,8 +2037,10 @@ void ProfileManager::AddProfileToStorage(Profile* profile) {
|
|
init_params.icon_index =
|
|
profile->GetPrefs()->GetInteger(prefs::kProfileAvatarIndex);
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
init_params.supervised_user_id =
|
|
profile->GetPrefs()->GetString(prefs::kSupervisedUserId);
|
|
+#endif
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
user_manager::User* user =
|
|
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
|
|
@@ -90,9 +90,11 @@ void ManagedUIHandler::AddObservers() {
|
|
policy_service->AddObserver(domain, this);
|
|
}
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
pref_registrar_.Add(prefs::kSupervisedUserId,
|
|
base::BindRepeating(&ManagedUIHandler::NotifyIfChanged,
|
|
base::Unretained(this)));
|
|
+#endif
|
|
}
|
|
|
|
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
|
|
@@ -1507,10 +1507,12 @@ void ManagementUIHandler::AddObservers() {
|
|
|
|
pref_registrar_.Init(profile->GetPrefs());
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
pref_registrar_.Add(
|
|
prefs::kSupervisedUserId,
|
|
base::BindRepeating(&ManagementUIHandler::UpdateManagedState,
|
|
base::Unretained(this)));
|
|
+#endif
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
pref_registrar_.Add(
|
|
diff --git a/components/supervised_user/buildflags.gni b/components/supervised_user/buildflags.gni
|
|
--- a/components/supervised_user/buildflags.gni
|
|
+++ b/components/supervised_user/buildflags.gni
|
|
@@ -4,9 +4,5 @@
|
|
|
|
declare_args() {
|
|
# Enables supervision for Family Link users.
|
|
- enable_supervised_users =
|
|
- # Platforms which fully support supervision features:
|
|
- is_android || is_chromeos ||
|
|
- # Platforms for which support is currently in development:
|
|
- is_ios || is_linux || is_mac || is_win
|
|
+ enable_supervised_users = false
|
|
}
|
|
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
|
|
@@ -173,7 +173,7 @@ bool IsChildAccountStatusKnown(const PrefService& pref_service) {
|
|
}
|
|
|
|
bool IsChildAccount(const PrefService& pref_service) {
|
|
- return pref_service.GetString(prefs::kSupervisedUserId) == kChildAccountSUID;
|
|
+ return false;
|
|
}
|
|
|
|
bool IsSafeSitesEnabled(const PrefService& pref_service) {
|
|
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
|
|
@@ -81,11 +81,15 @@ GURL NormalizeUrl(const GURL& url) {
|
|
}
|
|
|
|
bool AreWebFilterPrefsDefault(const PrefService& pref_service) {
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
return pref_service
|
|
.FindPreference(prefs::kDefaultSupervisedUserFilteringBehavior)
|
|
->IsDefaultValue() ||
|
|
pref_service.FindPreference(prefs::kSupervisedUserSafeSites)
|
|
->IsDefaultValue();
|
|
+#else
|
|
+ return true;
|
|
+#endif
|
|
}
|
|
|
|
bool EmitLogRecordHistograms(
|
|
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
|
|
@@ -163,4 +163,5 @@ bool IsShadowKidsApiWithSafeSitesEnabled() {
|
|
return base::FeatureList::IsEnabled(kShadowKidsApiWithSafeSites);
|
|
}
|
|
|
|
+SET_CROMITE_FEATURE_DISABLED(kForceGoogleSafeSearchForSupervisedUsers);
|
|
} // namespace supervised_user
|
|
diff --git a/components/supervised_user/core/common/pref_names.h b/components/supervised_user/core/common/pref_names.h
|
|
--- a/components/supervised_user/core/common/pref_names.h
|
|
+++ b/components/supervised_user/core/common/pref_names.h
|
|
@@ -5,8 +5,10 @@
|
|
#ifndef COMPONENTS_SUPERVISED_USER_CORE_COMMON_PREF_NAMES_H_
|
|
#define COMPONENTS_SUPERVISED_USER_CORE_COMMON_PREF_NAMES_H_
|
|
|
|
+#include "components/supervised_user/core/common/buildflags.h"
|
|
#include "extensions/buildflags/buildflags.h"
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
namespace prefs {
|
|
|
|
// A bool pref that keeps whether the child status for this profile was already
|
|
@@ -132,4 +134,6 @@ inline constexpr char kFirstTimeInterstitialBannerState[] =
|
|
|
|
} // namespace prefs
|
|
|
|
+#endif // BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
+
|
|
#endif // COMPONENTS_SUPERVISED_USER_CORE_COMMON_PREF_NAMES_H_
|
|
diff --git a/components/supervised_user/core/common/supervised_user_constants.cc b/components/supervised_user/core/common/supervised_user_constants.cc
|
|
--- a/components/supervised_user/core/common/supervised_user_constants.cc
|
|
+++ b/components/supervised_user/core/common/supervised_user_constants.cc
|
|
@@ -70,6 +70,7 @@ const char kChromeOSAvatarIndex[] = "chromeos-avatar-index";
|
|
|
|
const char kChromeOSPasswordData[] = "chromeos-password-data";
|
|
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
const char* const kCustodianInfoPrefs[] = {
|
|
prefs::kSupervisedUserCustodianName,
|
|
prefs::kSupervisedUserCustodianEmail,
|
|
@@ -82,6 +83,7 @@ const char* const kCustodianInfoPrefs[] = {
|
|
prefs::kSupervisedUserSecondCustodianProfileURL,
|
|
prefs::kSupervisedUserSecondCustodianProfileImageURL,
|
|
};
|
|
+#endif
|
|
|
|
const base::FilePath::CharType kSupervisedUserSettingsFilename[] =
|
|
FILE_PATH_LITERAL("Managed Mode Settings");
|
|
--
|