summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakuegel@chromium.org <akuegel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-19 15:58:33 +0000
committerakuegel@chromium.org <akuegel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-19 15:58:33 +0000
commit9167bc8a6939e84662bd5cae5792cc9dc081cfea (patch)
tree30cc505b717bb40f60f1d2be645ef49ecd97fecb
parent52cfbef8a1370cd82b968cdff35905a75d2f06c0 (diff)
downloadchromium_src-9167bc8a6939e84662bd5cae5792cc9dc081cfea.zip
chromium_src-9167bc8a6939e84662bd5cae5792cc9dc081cfea.tar.gz
chromium_src-9167bc8a6939e84662bd5cae5792cc9dc081cfea.tar.bz2
Merge 287309 "Use the display name on ChromeOS instead of the pr..."
> Use the display name on ChromeOS instead of the profile name. > > Add a method to determine the name of a supervised user. So far, we used > the profile name, but this doesn't work on ChromeOS. > > BUG=399320 > > Review URL: https://codereview.chromium.org/431893004 TBR=akuegel@chromium.org Review URL: https://codereview.chromium.org/490493003 git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@290569 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/supervised_user/supervised_user_service.cc15
-rw-r--r--chrome/browser/supervised_user/supervised_user_service.h3
2 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc
index d20661e..dfc1e16 100644
--- a/chrome/browser/supervised_user/supervised_user_service.cc
+++ b/chrome/browser/supervised_user/supervised_user_service.cc
@@ -593,7 +593,7 @@ void SupervisedUserService::SetActive(bool active) {
settings_service,
SupervisedUserSharedSettingsServiceFactory::GetForBrowserContext(
profile_),
- pref_service->GetString(prefs::kProfileName),
+ GetSupervisedUserName(),
pref_service->GetString(prefs::kSupervisedUserId)));
}
@@ -748,3 +748,16 @@ void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) {
is_profile_active_ = profile_became_active;
}
+
+std::string SupervisedUserService::GetSupervisedUserName() const {
+#if defined(OS_CHROMEOS)
+ // The active user can be NULL in unit tests.
+ if (chromeos::UserManager::Get()->GetActiveUser()) {
+ return UTF16ToUTF8(chromeos::UserManager::Get()->GetUserDisplayName(
+ chromeos::UserManager::Get()->GetActiveUser()->GetUserID()));
+ }
+ return std::string();
+#else
+ return profile_->GetPrefs()->GetString(prefs::kProfileName);
+#endif
+}
diff --git a/chrome/browser/supervised_user/supervised_user_service.h b/chrome/browser/supervised_user/supervised_user_service.h
index ae20046..e2165b9 100644
--- a/chrome/browser/supervised_user/supervised_user_service.h
+++ b/chrome/browser/supervised_user/supervised_user_service.h
@@ -251,6 +251,9 @@ class SupervisedUserService : public KeyedService,
// corresponding preference is changed.
void UpdateManualURLs();
+ // Returns the human readable name of the supervised user.
+ std::string GetSupervisedUserName() const;
+
// Owns us via the KeyedService mechanism.
Profile* profile_;