Commit 4d4b37bf authored by Danan S's avatar Danan S Committed by Commit Bot

Fix bug preventing display of Parental Controls in SplitSettings

Also, hide Parental controls from regular settings if SplitSettings
is enabled.

Bug: 977615
Change-Id: I13aa6f32aec8768e94bc2bf4730fb62209633c80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1740306
Commit-Queue: Danan S <danan@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685326}
parent dc9ad8da
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="../../controls/settings_toggle_button.html"> <link rel="import" href="../../controls/settings_toggle_button.html">
<link rel="import" href="../../icons.html"> <link rel="import" href="../../icons.html">
<link rel="import" href="../../parental_controls_page/parental_controls_page.html">
<link rel="import" href="../../people_page/account_manager.html"> <link rel="import" href="../../people_page/account_manager.html">
<link rel="import" href="../../people_page/account_manager_browser_proxy.html"> <link rel="import" href="../../people_page/account_manager_browser_proxy.html">
<link rel="import" href="../../people_page/fingerprint_list.html"> <link rel="import" href="../../people_page/fingerprint_list.html">
...@@ -165,6 +166,11 @@ ...@@ -165,6 +166,11 @@
label="$i18n{manageOtherPeople}" on-click="onManageOtherPeople_"> label="$i18n{manageOtherPeople}" on-click="onManageOtherPeople_">
</cr-link-row> </cr-link-row>
<template is="dom-if" if="[[showParentalControls_]]">
<settings-parental-controls-page>
</settings-parental-controls-page>
</template>
<template is="dom-if" if="[[isKerberosEnabled_]]"> <template is="dom-if" if="[[isKerberosEnabled_]]">
<cr-link-row id="kerberos-accounts-subpage-trigger" class="hr" <cr-link-row id="kerberos-accounts-subpage-trigger" class="hr"
on-click="onKerberosAccountsTap_" on-click="onKerberosAccountsTap_"
...@@ -218,10 +224,6 @@ ...@@ -218,10 +224,6 @@
</settings-subpage> </settings-subpage>
</template> </template>
</template> </template>
<template is="dom-if" if="[[showParentalControls_]]">
<settings-parental-controls-page>
</settings-parental-controls-page>
</template>
<template is="dom-if" route-path="/accounts"> <template is="dom-if" route-path="/accounts">
<settings-subpage <settings-subpage
associated-control="[[$$('#manage-other-people-subpage-trigger')]]" associated-control="[[$$('#manage-other-people-subpage-trigger')]]"
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "chrome/browser/ui/webui/settings/about_handler.h" #include "chrome/browser/ui/webui/settings/about_handler.h"
#include "chrome/browser/ui/webui/settings/accessibility_main_handler.h" #include "chrome/browser/ui/webui/settings/accessibility_main_handler.h"
#include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h" #include "chrome/browser/ui/webui/settings/browser_lifetime_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/parental_controls_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/wallpaper_handler.h"
#include "chrome/browser/ui/webui/settings/downloads_handler.h" #include "chrome/browser/ui/webui/settings/downloads_handler.h"
#include "chrome/browser/ui/webui/settings/extension_control_handler.h" #include "chrome/browser/ui/webui/settings/extension_control_handler.h"
...@@ -68,6 +69,10 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui) ...@@ -68,6 +69,10 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
// page_visibility.js). // page_visibility.js).
html_source->AddBoolean("showOSSettings", true); html_source->AddBoolean("showOSSettings", true);
html_source->AddBoolean(
"showParentalControls",
chromeos::settings::ShouldShowParentalControls(profile));
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
std::make_unique<::settings::AccessibilityMainHandler>()); std::make_unique<::settings::AccessibilityMainHandler>());
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/chromeos/arc/arc_session_manager.h" #include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_navigator_params.h"
...@@ -18,6 +20,7 @@ ...@@ -18,6 +20,7 @@
#include "chrome/services/app_service/public/cpp/app_registry_cache.h" #include "chrome/services/app_service/public/cpp/app_registry_cache.h"
#include "chrome/services/app_service/public/cpp/app_update.h" #include "chrome/services/app_service/public/cpp/app_update.h"
#include "chrome/services/app_service/public/mojom/types.mojom.h" #include "chrome/services/app_service/public/mojom/types.mojom.h"
#include "chromeos/constants/chromeos_features.h"
#include "components/arc/arc_util.h" #include "components/arc/arc_util.h"
#include "ui/base/page_transition_types.h" #include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
...@@ -96,5 +99,17 @@ void ParentalControlsHandler::HandleLaunchFamilyLinkSettings( ...@@ -96,5 +99,17 @@ void ParentalControlsHandler::HandleLaunchFamilyLinkSettings(
} }
} }
bool ShouldShowParentalControls(Profile* profile) {
// Show Parental controls for regular and child accounts that are the
// primary profile. Do not show it to any secondary profiles, managed
// accounts that aren't child accounts (i.e. enterprise and EDU accounts),
// OTR accounts, or legacy supervised user accounts.
return chromeos::features::IsParentalControlsSettingsEnabled() &&
profile == ProfileManager::GetPrimaryUserProfile() &&
!profile->IsLegacySupervised() && !profile->IsGuestSession() &&
(profile->IsChild() ||
!profile->GetProfilePolicyConnector()->IsManaged());
}
} // namespace settings } // namespace settings
} // namespace chromeos } // namespace chromeos
...@@ -37,6 +37,9 @@ class ParentalControlsHandler : public ::settings::SettingsPageUIHandler { ...@@ -37,6 +37,9 @@ class ParentalControlsHandler : public ::settings::SettingsPageUIHandler {
DISALLOW_COPY_AND_ASSIGN(ParentalControlsHandler); DISALLOW_COPY_AND_ASSIGN(ParentalControlsHandler);
}; };
// Indicates whether parental controls should be shown in the settings UI.
bool ShouldShowParentalControls(Profile* profile);
} // namespace settings } // namespace settings
} // namespace chromeos } // namespace chromeos
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "base/stl_util.h" #include "base/stl_util.h"
#include "build/branding_buildflags.h" #include "build/branding_buildflags.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/policy/profile_policy_connector.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
...@@ -93,7 +92,6 @@ ...@@ -93,7 +92,6 @@
#include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h" #include "chrome/browser/chromeos/multidevice_setup/multidevice_setup_client_factory.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h" #include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h" #include "chrome/browser/ui/webui/chromeos/smb_shares/smb_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h"
#include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h" #include "chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h"
...@@ -154,26 +152,6 @@ ...@@ -154,26 +152,6 @@
#endif #endif
namespace settings { namespace settings {
namespace {
#if defined(OS_CHROMEOS)
bool ShouldShowParentalControls(Profile* profile) {
// Show Parental controls for regular and child accounts that are the
// primary profile. Do not show it to any secondary profiles, managed
// accounts that aren't child accounts (i.e. enterprise and EDU accounts),
// OTR accounts, or legacy supervised user accounts.
return chromeos::features::IsParentalControlsSettingsEnabled() &&
profile == ProfileManager::GetPrimaryUserProfile() &&
!profile->IsLegacySupervised() && !profile->IsGuestSession() &&
(profile->IsChild() ||
!profile->GetProfilePolicyConnector()->IsManaged());
}
#endif // defined(OS_CHROMEOS)
} // namespace
// static // static
void SettingsUI::RegisterProfilePrefs( void SettingsUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { user_prefs::PrefRegistrySyncable* registry) {
...@@ -301,8 +279,9 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -301,8 +279,9 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
password_manager::features::kPasswordImport)); password_manager::features::kPasswordImport));
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
html_source->AddBoolean("showParentalControls", html_source->AddBoolean(
ShouldShowParentalControls(profile)); "showParentalControls",
chromeos::settings::ShouldShowParentalControls(profile));
#endif #endif
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -460,7 +439,7 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile, ...@@ -460,7 +439,7 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
: nullptr, : nullptr,
android_sms_service ? android_sms_service->android_sms_app_manager() android_sms_service ? android_sms_service->android_sms_app_manager()
: nullptr)); : nullptr));
if (ShouldShowParentalControls(profile)) { if (chromeos::settings::ShouldShowParentalControls(profile)) {
web_ui->AddMessageHandler( web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::ParentalControlsHandler>( std::make_unique<chromeos::settings::ParentalControlsHandler>(
profile)); profile));
...@@ -536,8 +515,9 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile, ...@@ -536,8 +515,9 @@ void SettingsUI::InitOSWebUIHandlers(Profile* profile,
web_ui->AddMessageHandler( web_ui->AddMessageHandler(
std::make_unique<chromeos::settings::PowerHandler>(profile->GetPrefs())); std::make_unique<chromeos::settings::PowerHandler>(profile->GetPrefs()));
html_source->AddBoolean("showParentalControlsSettings", html_source->AddBoolean(
ShouldShowParentalControls(profile)); "showParentalControlsSettings",
chromeos::settings::ShouldShowParentalControls(profile));
} }
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment