Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
index 35a6e9ed694ef477ffdb5146e0224d01d694149a..11bddcfec7d98278f10c0a13d2b546466af1ecfd 100644 |
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc |
@@ -110,6 +110,11 @@ |
#include "ui/chromeos/ime/input_method_menu_item.h" |
#include "ui/chromeos/ime/input_method_menu_manager.h" |
+#if defined(ENABLE_SUPERVISED_USERS) |
+#include "chrome/browser/supervised_user/supervised_user_service.h" |
+#include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
+#endif |
+ |
namespace chromeos { |
namespace { |
@@ -395,12 +400,9 @@ const base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserMessage() |
const { |
if (!IsUserSupervised()) |
return base::string16(); |
- std::string user_manager_name = GetSupervisedUserManager(); |
- LOG_IF(WARNING, user_manager_name.empty()) << |
- "Returning incomplete supervised user message as manager not known yet."; |
- return l10n_util::GetStringFUTF16( |
- IDS_USER_IS_SUPERVISED_BY_NOTICE, |
- base::UTF8ToUTF16(user_manager_name)); |
+ if (IsUserChild()) |
+ return GetChildUserMessage(); |
+ return GetLegacySupervisedUserMessage(); |
} |
bool SystemTrayDelegateChromeOS::IsUserSupervised() const { |
@@ -408,6 +410,10 @@ bool SystemTrayDelegateChromeOS::IsUserSupervised() const { |
return user && user->IsSupervised(); |
} |
+bool SystemTrayDelegateChromeOS::IsUserChild() const { |
+ return user_manager::UserManager::Get()->IsLoggedInAsChildUser(); |
+} |
+ |
void SystemTrayDelegateChromeOS::GetSystemUpdateInfo( |
ash::UpdateInfo* info) const { |
GetUpdateInfo(UpgradeDetector::GetInstance(), info); |
@@ -1318,6 +1324,41 @@ void SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged( |
OnAccessibilityModeChanged(details.notify); |
} |
+const base::string16 |
+SystemTrayDelegateChromeOS::GetLegacySupervisedUserMessage() const { |
+ std::string user_manager_name = GetSupervisedUserManager(); |
+ return l10n_util::GetStringFUTF16( |
+ IDS_USER_IS_SUPERVISED_BY_NOTICE, |
+ base::UTF8ToUTF16(user_manager_name)); |
+} |
+ |
+const base::string16 |
+SystemTrayDelegateChromeOS::GetChildUserMessage() const { |
+#if defined(ENABLE_SUPERVISED_USERS) |
+ SupervisedUserService* service = |
+ SupervisedUserServiceFactory::GetForProfile(user_profile_); |
+ base::string16 first_custodian = |
+ base::UTF8ToUTF16(service->GetCustodianEmailAddress()); |
+ base::string16 second_custodian = |
+ base::UTF8ToUTF16(service->GetSecondCustodianEmailAddress()); |
+ LOG_IF(WARNING, first_custodian.empty()) << |
+ "Returning incomplete child user message as manager not known yet."; |
+ if (second_custodian.empty()) { |
+ return l10n_util::GetStringFUTF16( |
+ IDS_CHILD_USER_IS_MANAGED_BY_ONE_PARENT_NOTICE, first_custodian); |
+ } else { |
+ return l10n_util::GetStringFUTF16( |
+ IDS_CHILD_USER_IS_MANAGED_BY_TWO_PARENTS_NOTICE, |
+ first_custodian, |
+ second_custodian); |
+ } |
+#endif |
+ |
+ LOG(WARNING) << "SystemTrayDelegateChromeOS::GetChildUserMessage call while " |
+ << "ENABLE_SUPERVISED_USERS undefined."; |
+ return base::string16(); |
+} |
+ |
ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
return new SystemTrayDelegateChromeOS(); |
} |