262 lines
12 KiB
Diff
262 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 -
|
|
chrome/android/chrome_java_sources.gni | 1 -
|
|
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 ++
|
|
.../browser/ui/webui/management/management_ui_handler.cc | 2 ++
|
|
components/supervised_user/buildflags.gni | 6 +-----
|
|
components/supervised_user/core/common/pref_names.h | 4 ++++
|
|
.../core/common/supervised_user_constants.cc | 2 ++
|
|
.../supervised_user/core/common/supervised_user_utils.cc | 8 ++++++++
|
|
12 files changed, 29 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
|
--- a/chrome/android/BUILD.gn
|
|
+++ b/chrome/android/BUILD.gn
|
|
@@ -3603,7 +3603,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
|
|
@@ -1074,7 +1074,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/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
|
--- a/chrome/browser/BUILD.gn
|
|
+++ b/chrome/browser/BUILD.gn
|
|
@@ -3182,8 +3182,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",
|
|
@@ -3398,10 +3396,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
|
|
@@ -1027,9 +1027,11 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() {
|
|
settings_api::PrefType::PREF_TYPE_BOOLEAN;
|
|
#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::PREF_TYPE_BOOLEAN;
|
|
+#endif
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_LACROS)
|
|
(*s_allowlist)[::prefs::kUseAshProxy] =
|
|
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
|
|
@@ -691,10 +691,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(
|
|
@@ -1614,11 +1616,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
|
|
@@ -1219,6 +1219,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)
|
|
@@ -1240,6 +1241,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
|
|
@@ -1456,10 +1456,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/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
|
|
@@ -124,4 +126,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
|
|
@@ -68,6 +68,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,
|
|
@@ -80,6 +81,7 @@ const char* const kCustodianInfoPrefs[] = {
|
|
prefs::kSupervisedUserSecondCustodianProfileURL,
|
|
prefs::kSupervisedUserSecondCustodianProfileImageURL,
|
|
};
|
|
+#endif
|
|
|
|
const base::FilePath::CharType kSupervisedUserSettingsFilename[] =
|
|
FILE_PATH_LITERAL("Managed Mode Settings");
|
|
diff --git a/components/supervised_user/core/common/supervised_user_utils.cc b/components/supervised_user/core/common/supervised_user_utils.cc
|
|
--- a/components/supervised_user/core/common/supervised_user_utils.cc
|
|
+++ b/components/supervised_user/core/common/supervised_user_utils.cc
|
|
@@ -76,11 +76,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 // BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
}
|
|
|
|
bool EmitLogSegmentHistogram(const std::vector<AccountInfo>& primary_accounts) {
|
|
@@ -107,10 +111,14 @@ bool EmitLogSegmentHistogram(const std::vector<AccountInfo>& primary_accounts) {
|
|
}
|
|
|
|
bool IsSubjectToParentalControls(const PrefService* pref_service) {
|
|
+#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
|
|
return pref_service &&
|
|
pref_service->GetString(prefs::kSupervisedUserId) ==
|
|
kChildAccountSUID &&
|
|
IsChildAccountSupervisionEnabled();
|
|
+#else
|
|
+ return false;
|
|
+#endif
|
|
}
|
|
|
|
} // namespace supervised_user
|
|
--
|
|
2.25.1
|