summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r--chrome/browser/profiles/avatar_menu.cc6
-rw-r--r--chrome/browser/profiles/avatar_menu.h14
-rw-r--r--chrome/browser/profiles/avatar_menu_actions_desktop.cc2
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc4
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.h2
-rw-r--r--chrome/browser/profiles/profile.h4
-rw-r--r--chrome/browser/profiles/profile_impl.cc21
-rw-r--r--chrome/browser/profiles/profile_impl.h4
-rw-r--r--chrome/browser/profiles/profile_info_cache.cc50
-rw-r--r--chrome/browser/profiles/profile_info_cache.h19
-rw-r--r--chrome/browser/profiles/profile_info_cache_unittest.cc50
-rw-r--r--chrome/browser/profiles/profile_info_interface.h5
-rw-r--r--chrome/browser/profiles/profile_list_desktop.cc6
-rw-r--r--chrome/browser/profiles/profile_manager.cc68
-rw-r--r--chrome/browser/profiles/profile_manager.h9
-rw-r--r--chrome/browser/profiles/profile_manager_unittest.cc41
-rw-r--r--chrome/browser/profiles/profile_metrics.cc14
17 files changed, 166 insertions, 153 deletions
diff --git a/chrome/browser/profiles/avatar_menu.cc b/chrome/browser/profiles/avatar_menu.cc
index c8dad05..209dda2 100644
--- a/chrome/browser/profiles/avatar_menu.cc
+++ b/chrome/browser/profiles/avatar_menu.cc
@@ -185,9 +185,9 @@ size_t AvatarMenu::GetActiveProfileIndex() {
return index;
}
-base::string16 AvatarMenu::GetManagedUserInformation() const {
+base::string16 AvatarMenu::GetSupervisedUserInformation() const {
// |browser_| can be NULL in unit_tests.
- if (browser_ && browser_->profile()->IsManaged()) {
+ if (browser_ && browser_->profile()->IsSupervised()) {
#if defined(ENABLE_MANAGED_USERS)
ManagedUserService* service = ManagedUserServiceFactory::GetForProfile(
browser_->profile());
@@ -199,7 +199,7 @@ base::string16 AvatarMenu::GetManagedUserInformation() const {
return base::string16();
}
-const gfx::Image& AvatarMenu::GetManagedUserIcon() const {
+const gfx::Image& AvatarMenu::GetSupervisedUserIcon() const {
return ResourceBundle::GetSharedInstance().GetNativeImageNamed(
IDR_MANAGED_USER_ICON);
}
diff --git a/chrome/browser/profiles/avatar_menu.h b/chrome/browser/profiles/avatar_menu.h
index 6679741..c58de8d 100644
--- a/chrome/browser/profiles/avatar_menu.h
+++ b/chrome/browser/profiles/avatar_menu.h
@@ -57,9 +57,9 @@ class AvatarMenu : public content::NotificationObserver {
// Whether or not the current profile requires sign-in before use.
bool signin_required;
- // Whether or not the current profile is a managed user
+ // Whether or not the current profile is a supervised user
// (see ManagedUserService).
- bool managed;
+ bool supervised;
// The index in the menu of this profile, used by views to refer to
// profiles.
@@ -117,14 +117,14 @@ class AvatarMenu : public content::NotificationObserver {
// Returns the index of the active profile.
size_t GetActiveProfileIndex();
- // Returns information about a managed user which will be displayed in the
- // avatar menu. If the profile does not belong to a managed user, an empty
+ // Returns information about a supervised user which will be displayed in the
+ // avatar menu. If the profile does not belong to a supervised user, an empty
// string will be returned.
- base::string16 GetManagedUserInformation() const;
+ base::string16 GetSupervisedUserInformation() const;
- // Returns the icon for the managed user which will be displayed in the
+ // Returns the icon for the supervised user which will be displayed in the
// avatar menu.
- const gfx::Image& GetManagedUserIcon() const;
+ const gfx::Image& GetSupervisedUserIcon() const;
// This menu is also used for the always-present Mac system menubar. If the
// last active browser changes, the menu will need to reference that browser.
diff --git a/chrome/browser/profiles/avatar_menu_actions_desktop.cc b/chrome/browser/profiles/avatar_menu_actions_desktop.cc
index 7664b61..ba8b94b 100644
--- a/chrome/browser/profiles/avatar_menu_actions_desktop.cc
+++ b/chrome/browser/profiles/avatar_menu_actions_desktop.cc
@@ -62,7 +62,7 @@ void AvatarMenuActionsDesktop::EditProfile(Profile* profile, size_t index) {
bool AvatarMenuActionsDesktop::ShouldShowAddNewProfileLink() const {
// |browser_| can be NULL in unit_tests.
- if (browser_ && browser_->profile()->IsManaged())
+ if (browser_ && browser_->profile()->IsSupervised())
return false;
#if defined(OS_WIN)
return chrome::GetActiveDesktop() != chrome::HOST_DESKTOP_TYPE_ASH;
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index a6443e3..3f5f445 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -263,8 +263,8 @@ ExtensionSpecialStoragePolicy*
return GetOriginalProfile()->GetExtensionSpecialStoragePolicy();
}
-bool OffTheRecordProfileImpl::IsManaged() {
- return GetOriginalProfile()->IsManaged();
+bool OffTheRecordProfileImpl::IsSupervised() {
+ return GetOriginalProfile()->IsSupervised();
}
PrefService* OffTheRecordProfileImpl::GetPrefs() {
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h
index c48bdad..e4a8685 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.h
+++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -42,7 +42,7 @@ class OffTheRecordProfileImpl : public Profile {
virtual void DestroyOffTheRecordProfile() OVERRIDE;
virtual bool HasOffTheRecordProfile() OVERRIDE;
virtual Profile* GetOriginalProfile() OVERRIDE;
- virtual bool IsManaged() OVERRIDE;
+ virtual bool IsSupervised() OVERRIDE;
virtual ExtensionService* GetExtensionService() OVERRIDE;
virtual ExtensionSpecialStoragePolicy*
GetExtensionSpecialStoragePolicy() OVERRIDE;
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index a1dd521..1f5b5019 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -202,8 +202,8 @@ class Profile : public content::BrowserContext {
// profile is not incognito.
virtual Profile* GetOriginalProfile() = 0;
- // Returns whether the profile is managed (see ManagedUserService).
- virtual bool IsManaged() = 0;
+ // Returns whether the profile is supervised (see ManagedUserService).
+ virtual bool IsSupervised() = 0;
// Returns a pointer to the TopSites (thumbnail manager) instance
// for this profile.
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 3d5f319..dea1b55 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -336,14 +336,14 @@ void ProfileImpl::RegisterProfilePrefs(
prefs::kProfileAvatarIndex,
-1,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
- registry->RegisterStringPref(prefs::kManagedUserId,
+ registry->RegisterStringPref(prefs::kSupervisedUserId,
std::string(),
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterStringPref(prefs::kProfileName,
std::string(),
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(
- prefs::kProfileIsManaged,
+ prefs::kProfileIsSupervised,
false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterStringPref(prefs::kHomePage,
@@ -508,8 +508,8 @@ void ProfileImpl::DoFinalInit() {
base::Bind(&ProfileImpl::UpdateProfileUserNameCache,
base::Unretained(this)));
pref_change_registrar_.Add(
- prefs::kManagedUserId,
- base::Bind(&ProfileImpl::UpdateProfileManagedUserIdCache,
+ prefs::kSupervisedUserId,
+ base::Bind(&ProfileImpl::UpdateProfileSupervisedUserIdCache,
base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kDefaultZoomLevel,
@@ -542,7 +542,7 @@ void ProfileImpl::DoFinalInit() {
// kGoogleServicesUsername, initialize components that depend on it to reflect
// the current value.
UpdateProfileUserNameCache();
- UpdateProfileManagedUserIdCache();
+ UpdateProfileSupervisedUserIdCache();
UpdateProfileIsEphemeralCache();
GAIAInfoUpdateServiceFactory::GetForProfile(this);
@@ -801,8 +801,8 @@ Profile* ProfileImpl::GetOriginalProfile() {
return this;
}
-bool ProfileImpl::IsManaged() {
- return !GetPrefs()->GetString(prefs::kManagedUserId).empty();
+bool ProfileImpl::IsSupervised() {
+ return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty();
}
ExtensionService* ProfileImpl::GetExtensionService() {
@@ -1303,13 +1303,14 @@ void ProfileImpl::UpdateProfileUserNameCache() {
}
}
-void ProfileImpl::UpdateProfileManagedUserIdCache() {
+void ProfileImpl::UpdateProfileSupervisedUserIdCache() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
size_t index = cache.GetIndexOfProfileWithPath(GetPath());
if (index != std::string::npos) {
- std::string managed_user_id = GetPrefs()->GetString(prefs::kManagedUserId);
- cache.SetManagedUserIdOfProfileAtIndex(index, managed_user_id);
+ std::string supervised_user_id =
+ GetPrefs()->GetString(prefs::kSupervisedUserId);
+ cache.SetSupervisedUserIdOfProfileAtIndex(index, supervised_user_id);
ProfileMetrics::UpdateReportedProfilesStatistics(profile_manager);
}
}
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 3dde834..d0359bf 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -117,7 +117,7 @@ class ProfileImpl : public Profile {
virtual void DestroyOffTheRecordProfile() OVERRIDE;
virtual bool HasOffTheRecordProfile() OVERRIDE;
virtual Profile* GetOriginalProfile() OVERRIDE;
- virtual bool IsManaged() OVERRIDE;
+ virtual bool IsSupervised() OVERRIDE;
virtual history::TopSites* GetTopSites() OVERRIDE;
virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE;
virtual ExtensionService* GetExtensionService() OVERRIDE;
@@ -210,7 +210,7 @@ class ProfileImpl : public Profile {
// Updates the ProfileInfoCache with data from this profile.
void UpdateProfileUserNameCache();
- void UpdateProfileManagedUserIdCache();
+ void UpdateProfileSupervisedUserIdCache();
void UpdateProfileNameCache();
void UpdateProfileAvatarCache();
void UpdateProfileIsEphemeralCache();
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index e479fee..18919a8 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -49,10 +49,10 @@ const char kAuthCredentialsKey[] = "local_auth_credentials";
const char kUseGAIAPictureKey[] = "use_gaia_picture";
const char kBackgroundAppsKey[] = "background_apps";
const char kGAIAPictureFileNameKey[] = "gaia_picture_file_name";
-const char kIsManagedKey[] = "is_managed";
+const char kIsSupervisedKey[] = "is_managed";
const char kIsOmittedFromProfileListKey[] = "is_omitted_from_profile_list";
const char kSigninRequiredKey[] = "signin_required";
-const char kManagedUserId[] = "managed_user_id";
+const char kSupervisedUserId[] = "managed_user_id";
const char kProfileIsEphemeral[] = "is_ephemeral";
const char kActiveTimeKey[] = "active_time";
@@ -178,10 +178,11 @@ ProfileInfoCache::ProfileInfoCache(PrefService* prefs,
sorted_keys_.insert(FindPositionForProfile(it.key(), name), it.key());
// TODO(ibraaaa): delete this when 97% of our users are using M31.
// http://crbug.com/276163
- bool is_managed = false;
- if (info->GetBoolean(kIsManagedKey, &is_managed)) {
- info->Remove(kIsManagedKey, NULL);
- info->SetString(kManagedUserId, is_managed ? "DUMMY_ID" : std::string());
+ bool is_supervised = false;
+ if (info->GetBoolean(kIsSupervisedKey, &is_supervised)) {
+ info->Remove(kIsSupervisedKey, NULL);
+ info->SetString(kSupervisedUserId,
+ is_supervised ? "DUMMY_ID" : std::string());
}
info->SetBoolean(kIsUsingDefaultName, IsDefaultName(name));
}
@@ -203,11 +204,12 @@ ProfileInfoCache::~ProfileInfoCache() {
avatar_images_downloads_in_progress_.end());
}
-void ProfileInfoCache::AddProfileToCache(const base::FilePath& profile_path,
- const base::string16& name,
- const base::string16& username,
- size_t icon_index,
- const std::string& managed_user_id) {
+void ProfileInfoCache::AddProfileToCache(
+ const base::FilePath& profile_path,
+ const base::string16& name,
+ const base::string16& username,
+ size_t icon_index,
+ const std::string& supervised_user_id) {
std::string key = CacheKeyFromProfilePath(profile_path);
DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
base::DictionaryValue* cache = update.Get();
@@ -219,8 +221,8 @@ void ProfileInfoCache::AddProfileToCache(const base::FilePath& profile_path,
profiles::GetDefaultAvatarIconUrl(icon_index));
// Default value for whether background apps are running is false.
info->SetBoolean(kBackgroundAppsKey, false);
- info->SetString(kManagedUserId, managed_user_id);
- info->SetBoolean(kIsOmittedFromProfileListKey, !managed_user_id.empty());
+ info->SetString(kSupervisedUserId, supervised_user_id);
+ info->SetBoolean(kIsOmittedFromProfileListKey, !supervised_user_id.empty());
info->SetBoolean(kProfileIsEphemeral, false);
info->SetBoolean(kIsUsingDefaultName, IsDefaultName(name));
cache->SetWithoutPathExpansion(key, info.release());
@@ -405,8 +407,8 @@ bool ProfileInfoCache::IsUsingGAIAPictureOfProfileAtIndex(size_t index) const {
return value;
}
-bool ProfileInfoCache::ProfileIsManagedAtIndex(size_t index) const {
- return !GetManagedUserIdOfProfileAtIndex(index).empty();
+bool ProfileInfoCache::ProfileIsSupervisedAtIndex(size_t index) const {
+ return !GetSupervisedUserIdOfProfileAtIndex(index).empty();
}
bool ProfileInfoCache::IsOmittedProfileAtIndex(size_t index) const {
@@ -422,11 +424,12 @@ bool ProfileInfoCache::ProfileIsSigninRequiredAtIndex(size_t index) const {
return value;
}
-std::string ProfileInfoCache::GetManagedUserIdOfProfileAtIndex(
+std::string ProfileInfoCache::GetSupervisedUserIdOfProfileAtIndex(
size_t index) const {
- std::string managed_user_id;
- GetInfoForProfileAtIndex(index)->GetString(kManagedUserId, &managed_user_id);
- return managed_user_id;
+ std::string supervised_user_id;
+ GetInfoForProfileAtIndex(index)->GetString(kSupervisedUserId,
+ &supervised_user_id);
+ return supervised_user_id;
}
bool ProfileInfoCache::ProfileIsEphemeralAtIndex(size_t index) const {
@@ -541,13 +544,14 @@ void ProfileInfoCache::SetIsOmittedProfileAtIndex(size_t index,
SetInfoForProfileAtIndex(index, info.release());
}
-void ProfileInfoCache::SetManagedUserIdOfProfileAtIndex(size_t index,
- const std::string& id) {
- if (GetManagedUserIdOfProfileAtIndex(index) == id)
+void ProfileInfoCache::SetSupervisedUserIdOfProfileAtIndex(
+ size_t index,
+ const std::string& id) {
+ if (GetSupervisedUserIdOfProfileAtIndex(index) == id)
return;
scoped_ptr<base::DictionaryValue> info(
GetInfoForProfileAtIndex(index)->DeepCopy());
- info->SetString(kManagedUserId, id);
+ info->SetString(kSupervisedUserId, id);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
}
diff --git a/chrome/browser/profiles/profile_info_cache.h b/chrome/browser/profiles/profile_info_cache.h
index 341398b..3c1d430 100644
--- a/chrome/browser/profiles/profile_info_cache.h
+++ b/chrome/browser/profiles/profile_info_cache.h
@@ -39,17 +39,16 @@ class ProfileInfoCache : public ProfileInfoInterface,
ProfileInfoCache(PrefService* prefs, const base::FilePath& user_data_dir);
virtual ~ProfileInfoCache();
- // This |is_managed| refers to local management (formerly "managed mode"),
- // not enterprise management. If the |managed_user_id| is non-empty, the
- // profile will be marked to be omitted from the avatar-menu list on desktop
- // versions. This is used while a managed user is in the process of being
- // registered with the server. Use SetIsOmittedProfileAtIndex() to clear the
- // flag when the profile is ready to be shown in the menu.
+ // If the |supervised_user_id| is non-empty, the profile will be marked to be
+ // omitted from the avatar-menu list on desktop versions. This is used while a
+ // supervised user is in the process of being registered with the server. Use
+ // SetIsOmittedProfileAtIndex() to clear the flag when the profile is ready to
+ // be shown in the menu.
void AddProfileToCache(const base::FilePath& profile_path,
const base::string16& name,
const base::string16& username,
size_t icon_index,
- const std::string& managed_user_id);
+ const std::string& supervised_user_id);
void DeleteProfileFromCache(const base::FilePath& profile_path);
// ProfileInfoInterface:
@@ -85,10 +84,10 @@ class ProfileInfoCache : public ProfileInfoInterface,
size_t index) const OVERRIDE;
virtual bool IsUsingGAIAPictureOfProfileAtIndex(
size_t index) const OVERRIDE;
- virtual bool ProfileIsManagedAtIndex(size_t index) const OVERRIDE;
+ virtual bool ProfileIsSupervisedAtIndex(size_t index) const OVERRIDE;
virtual bool IsOmittedProfileAtIndex(size_t index) const OVERRIDE;
virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const OVERRIDE;
- virtual std::string GetManagedUserIdOfProfileAtIndex(size_t index) const
+ virtual std::string GetSupervisedUserIdOfProfileAtIndex(size_t index) const
OVERRIDE;
virtual bool ProfileIsEphemeralAtIndex(size_t index) const OVERRIDE;
virtual bool ProfileIsUsingDefaultNameAtIndex(size_t index) const OVERRIDE;
@@ -103,7 +102,7 @@ class ProfileInfoCache : public ProfileInfoInterface,
const base::string16& user_name);
void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index);
void SetIsOmittedProfileAtIndex(size_t index, bool is_omitted);
- void SetManagedUserIdOfProfileAtIndex(size_t index, const std::string& id);
+ void SetSupervisedUserIdOfProfileAtIndex(size_t index, const std::string& id);
void SetLocalAuthCredentialsOfProfileAtIndex(size_t index,
const std::string& auth);
void SetBackgroundStatusOfProfileAtIndex(size_t index,
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc
index 1907a22..92638ae 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -131,10 +131,10 @@ TEST_F(ProfileInfoCacheTest, AddProfiles) {
const SkBitmap* icon = rb.GetImageNamed(
profiles::GetDefaultAvatarIconResourceIDAtIndex(
i)).ToSkBitmap();
- std::string managed_user_id = i == 3 ? "TEST_ID" : "";
+ std::string supervised_user_id = i == 3 ? "TEST_ID" : "";
GetCache()->AddProfileToCache(profile_path, profile_name, base::string16(),
- i, managed_user_id);
+ i, supervised_user_id);
GetCache()->SetBackgroundStatusOfProfileAtIndex(i, true);
base::string16 gaia_name = ASCIIToUTF16(base::StringPrintf("gaia_%ud", i));
GetCache()->SetGAIANameOfProfileAtIndex(i, gaia_name);
@@ -146,9 +146,10 @@ TEST_F(ProfileInfoCacheTest, AddProfiles) {
GetCache()->GetAvatarIconOfProfileAtIndex(i).ToSkBitmap();
EXPECT_EQ(icon->width(), actual_icon->width());
EXPECT_EQ(icon->height(), actual_icon->height());
- EXPECT_EQ(i == 3, GetCache()->ProfileIsManagedAtIndex(i));
+ EXPECT_EQ(i == 3, GetCache()->ProfileIsSupervisedAtIndex(i));
EXPECT_EQ(i == 3, GetCache()->IsOmittedProfileAtIndex(i));
- EXPECT_EQ(managed_user_id, GetCache()->GetManagedUserIdOfProfileAtIndex(i));
+ EXPECT_EQ(supervised_user_id,
+ GetCache()->GetSupervisedUserIdOfProfileAtIndex(i));
}
// Reset the cache and test the it reloads correctly.
@@ -410,22 +411,22 @@ TEST_F(ProfileInfoCacheTest, PersistGAIAPicture) {
gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(0)));
}
-TEST_F(ProfileInfoCacheTest, SetManagedUserId) {
+TEST_F(ProfileInfoCacheTest, SetSupervisedUserId) {
GetCache()->AddProfileToCache(
GetProfilePath("test"), ASCIIToUTF16("Test"),
base::string16(), 0, std::string());
- EXPECT_FALSE(GetCache()->ProfileIsManagedAtIndex(0));
+ EXPECT_FALSE(GetCache()->ProfileIsSupervisedAtIndex(0));
- GetCache()->SetManagedUserIdOfProfileAtIndex(0, "TEST_ID");
- EXPECT_TRUE(GetCache()->ProfileIsManagedAtIndex(0));
- EXPECT_EQ("TEST_ID", GetCache()->GetManagedUserIdOfProfileAtIndex(0));
+ GetCache()->SetSupervisedUserIdOfProfileAtIndex(0, "TEST_ID");
+ EXPECT_TRUE(GetCache()->ProfileIsSupervisedAtIndex(0));
+ EXPECT_EQ("TEST_ID", GetCache()->GetSupervisedUserIdOfProfileAtIndex(0));
ResetCache();
- EXPECT_TRUE(GetCache()->ProfileIsManagedAtIndex(0));
+ EXPECT_TRUE(GetCache()->ProfileIsSupervisedAtIndex(0));
- GetCache()->SetManagedUserIdOfProfileAtIndex(0, std::string());
- EXPECT_FALSE(GetCache()->ProfileIsManagedAtIndex(0));
- EXPECT_EQ("", GetCache()->GetManagedUserIdOfProfileAtIndex(0));
+ GetCache()->SetSupervisedUserIdOfProfileAtIndex(0, std::string());
+ EXPECT_FALSE(GetCache()->ProfileIsSupervisedAtIndex(0));
+ EXPECT_EQ("", GetCache()->GetSupervisedUserIdOfProfileAtIndex(0));
}
TEST_F(ProfileInfoCacheTest, EmptyGAIAInfo) {
@@ -449,23 +450,24 @@ TEST_F(ProfileInfoCacheTest, EmptyGAIAInfo) {
profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0)));
}
-TEST_F(ProfileInfoCacheTest, CreateManagedTestingProfile) {
+TEST_F(ProfileInfoCacheTest, CreateSupervisedTestingProfile) {
testing_profile_manager_.CreateTestingProfile("default");
- base::string16 managed_user_name = ASCIIToUTF16("Supervised User");
+ base::string16 supervised_user_name = ASCIIToUTF16("Supervised User");
testing_profile_manager_.CreateTestingProfile(
"test1", scoped_ptr<PrefServiceSyncable>(),
- managed_user_name, 0, "TEST_ID", TestingProfile::TestingFactories());
+ supervised_user_name, 0, "TEST_ID", TestingProfile::TestingFactories());
for (size_t i = 0; i < GetCache()->GetNumberOfProfiles(); i++) {
- bool is_managed =
- GetCache()->GetNameOfProfileAtIndex(i) == managed_user_name;
- EXPECT_EQ(is_managed, GetCache()->ProfileIsManagedAtIndex(i));
- std::string managed_user_id = is_managed ? "TEST_ID" : "";
- EXPECT_EQ(managed_user_id, GetCache()->GetManagedUserIdOfProfileAtIndex(i));
+ bool is_supervised =
+ GetCache()->GetNameOfProfileAtIndex(i) == supervised_user_name;
+ EXPECT_EQ(is_supervised, GetCache()->ProfileIsSupervisedAtIndex(i));
+ std::string supervised_user_id = is_supervised ? "TEST_ID" : "";
+ EXPECT_EQ(supervised_user_id,
+ GetCache()->GetSupervisedUserIdOfProfileAtIndex(i));
}
- // Managed profiles have a custom theme, which needs to be deleted on the FILE
- // thread. Reset the profile manager now so everything is deleted while we
- // still have a FILE thread.
+ // Supervised profiles have a custom theme, which needs to be deleted on the
+ // FILE thread. Reset the profile manager now so everything is deleted while
+ // we still have a FILE thread.
TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
}
diff --git a/chrome/browser/profiles/profile_info_interface.h b/chrome/browser/profiles/profile_info_interface.h
index 66f6741..563fb63 100644
--- a/chrome/browser/profiles/profile_info_interface.h
+++ b/chrome/browser/profiles/profile_info_interface.h
@@ -59,13 +59,14 @@ class ProfileInfoInterface {
// Checks if the GAIA picture should be used as the profile's avatar icon.
virtual bool IsUsingGAIAPictureOfProfileAtIndex(size_t index) const = 0;
- virtual bool ProfileIsManagedAtIndex(size_t index) const = 0;
+ virtual bool ProfileIsSupervisedAtIndex(size_t index) const = 0;
// Returns true if the profile should be omitted from the desktop profile
// list (see ProfileListDesktop), so it won't appear in the avatar menu.
virtual bool IsOmittedProfileAtIndex(size_t index) const = 0;
- virtual std::string GetManagedUserIdOfProfileAtIndex(size_t index) const = 0;
+ virtual std::string GetSupervisedUserIdOfProfileAtIndex(
+ size_t index) const = 0;
// This profile is associated with an account but has been signed-out.
virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const = 0;
diff --git a/chrome/browser/profiles/profile_list_desktop.cc b/chrome/browser/profiles/profile_list_desktop.cc
index 59ffb78..cf69b3c 100644
--- a/chrome/browser/profiles/profile_list_desktop.cc
+++ b/chrome/browser/profiles/profile_list_desktop.cc
@@ -51,12 +51,12 @@ void ProfileListDesktop::RebuildMenu() {
item->name = profile_info_->GetNameOfProfileAtIndex(i);
item->sync_state = profile_info_->GetUserNameOfProfileAtIndex(i);
item->profile_path = profile_info_->GetPathOfProfileAtIndex(i);
- item->managed = profile_info_->ProfileIsManagedAtIndex(i);
+ item->supervised = profile_info_->ProfileIsSupervisedAtIndex(i);
item->signed_in = !item->sync_state.empty();
if (!item->signed_in) {
item->sync_state = l10n_util::GetStringUTF16(
- item->managed ? IDS_MANAGED_USER_AVATAR_LABEL :
- IDS_PROFILES_LOCAL_PROFILE_STATE);
+ item->supervised ? IDS_MANAGED_USER_AVATAR_LABEL :
+ IDS_PROFILES_LOCAL_PROFILE_STATE);
}
item->active = profile_info_->GetPathOfProfileAtIndex(i) ==
active_profile_path_;
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 3634ad4..0396ab2 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -372,7 +372,7 @@ void ProfileManager::CreateProfileAsync(
const CreateCallback& callback,
const base::string16& name,
const base::string16& icon_url,
- const std::string& managed_user_id) {
+ const std::string& supervised_user_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Make sure that this profile is not pending deletion.
@@ -398,10 +398,10 @@ void ProfileManager::CreateProfileAsync(
if (profiles::IsDefaultAvatarIconUrl(icon_url_std, &icon_index)) {
// add profile to cache with user selected name and avatar
cache.AddProfileToCache(profile_path, name, base::string16(), icon_index,
- managed_user_id);
+ supervised_user_id);
}
- if (!managed_user_id.empty()) {
+ if (!supervised_user_id.empty()) {
content::RecordAction(
UserMetricsAction("ManagedMode_LocallyManagedUserCreated"));
}
@@ -561,7 +561,7 @@ base::FilePath ProfileManager::CreateMultiProfileAsync(
const base::string16& name,
const base::string16& icon_url,
const CreateCallback& callback,
- const std::string& managed_user_id) {
+ const std::string& supervised_user_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -572,7 +572,7 @@ base::FilePath ProfileManager::CreateMultiProfileAsync(
callback,
name,
icon_url,
- managed_user_id);
+ supervised_user_id);
return new_path;
}
@@ -640,22 +640,22 @@ void ProfileManager::ScheduleProfileForDeletion(
local_state->GetString(prefs::kProfileLastUsed)) {
// Update the last used profile pref before closing browser windows. This
// way the correct last used profile is set for any notification observers.
- base::FilePath last_non_managed_profile_path;
+ base::FilePath last_non_supervised_profile_path;
for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
base::FilePath cur_path = cache.GetPathOfProfileAtIndex(i);
// Make sure that this profile is not pending deletion.
- if (cur_path != profile_dir && !cache.ProfileIsManagedAtIndex(i) &&
+ if (cur_path != profile_dir && !cache.ProfileIsSupervisedAtIndex(i) &&
!IsProfileMarkedForDeletion(cur_path)) {
- last_non_managed_profile_path = cur_path;
+ last_non_supervised_profile_path = cur_path;
break;
}
}
- // If we're deleting the last (non-managed) profile, then create a new
+ // If we're deleting the last (non-supervised) profile, then create a new
// profile in its place.
- const std::string last_non_managed_profile =
- last_non_managed_profile_path.BaseName().MaybeAsASCII();
- if (last_non_managed_profile.empty()) {
+ const std::string last_non_supervised_profile =
+ last_non_supervised_profile_path.BaseName().MaybeAsASCII();
+ if (last_non_supervised_profile.empty()) {
base::FilePath new_path = GenerateNextProfileDirectoryPath();
// Make sure the last used profile path is pointing at it. This way the
// correct last used profile is set for any notification observers.
@@ -671,11 +671,11 @@ void ProfileManager::ScheduleProfileForDeletion(
// are closed, so just in case we are deleting the active profile, and no
// other profile has been loaded, we must pre-load a next one.
#if defined(OS_MACOSX)
- CreateProfileAsync(last_non_managed_profile_path,
+ CreateProfileAsync(last_non_supervised_profile_path,
base::Bind(&ProfileManager::OnNewActiveProfileLoaded,
base::Unretained(this),
profile_dir,
- last_non_managed_profile_path,
+ last_non_supervised_profile_path,
callback),
base::string16(),
base::string16(),
@@ -684,7 +684,8 @@ void ProfileManager::ScheduleProfileForDeletion(
#else
// For OS_MACOSX the pref is updated in the callback to make sure that
// it isn't used before the profile is actually loaded.
- local_state->SetString(prefs::kProfileLastUsed, last_non_managed_profile);
+ local_state->SetString(prefs::kProfileLastUsed,
+ last_non_supervised_profile);
#endif
}
}
@@ -731,7 +732,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
size_t avatar_index;
std::string profile_name;
- std::string managed_user_id;
+ std::string supervised_user_id;
if (profile->IsGuestSession()) {
profile_name = l10n_util::GetStringUTF8(IDS_PROFILES_GUEST_PROFILE_NAME);
avatar_index = 0;
@@ -744,8 +745,8 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
cache.GetAvatarIconIndexOfProfileAtIndex(profile_cache_index);
profile_name =
base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_cache_index));
- managed_user_id =
- cache.GetManagedUserIdOfProfileAtIndex(profile_cache_index);
+ supervised_user_id =
+ cache.GetSupervisedUserIdOfProfileAtIndex(profile_cache_index);
} else if (profile->GetPath() ==
profiles::GetDefaultProfileDir(cache.GetUserDataDir())) {
avatar_index = 0;
@@ -767,15 +768,16 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
profile->GetPrefs()->SetString(prefs::kProfileName, profile_name);
CommandLine* command_line = CommandLine::ForCurrentProcess();
- bool force_managed_user_id =
- command_line->HasSwitch(switches::kManagedUserId);
- if (force_managed_user_id) {
- managed_user_id =
- command_line->GetSwitchValueASCII(switches::kManagedUserId);
+ bool force_supervised_user_id =
+ command_line->HasSwitch(switches::kSupervisedUserId);
+ if (force_supervised_user_id) {
+ supervised_user_id =
+ command_line->GetSwitchValueASCII(switches::kSupervisedUserId);
}
- if (force_managed_user_id ||
- !profile->GetPrefs()->HasPrefPath(prefs::kManagedUserId)) {
- profile->GetPrefs()->SetString(prefs::kManagedUserId, managed_user_id);
+ if (force_supervised_user_id ||
+ !profile->GetPrefs()->HasPrefPath(prefs::kSupervisedUserId)) {
+ profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
+ supervised_user_id);
}
}
@@ -974,7 +976,7 @@ void ProfileManager::DoFinalInitForServices(Profile* profile,
#if defined(ENABLE_MANAGED_USERS)
// Initialization needs to happen after extension system initialization (for
// extension::ManagementPolicy) and InitProfileUserPrefs (for setting the
- // initializing the managed flag if necessary).
+ // initializing the supervised flag if necessary).
ManagedUserServiceFactory::GetForProfile(profile)->Init();
#endif
// Start the deferred task runners once the profile is loaded.
@@ -1133,14 +1135,14 @@ void ProfileManager::AddProfileToCache(Profile* profile) {
size_t icon_index = profile->GetPrefs()->GetInteger(
prefs::kProfileAvatarIndex);
- std::string managed_user_id =
- profile->GetPrefs()->GetString(prefs::kManagedUserId);
+ std::string supervised_user_id =
+ profile->GetPrefs()->GetString(prefs::kSupervisedUserId);
cache.AddProfileToCache(profile->GetPath(),
profile_name,
username,
icon_index,
- managed_user_id);
+ supervised_user_id);
if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) {
cache.SetProfileIsEphemeralAtIndex(
@@ -1258,7 +1260,7 @@ void ProfileManager::BrowserListObserver::OnBrowserSetLastActive(
#if defined(OS_MACOSX)
void ProfileManager::OnNewActiveProfileLoaded(
const base::FilePath& profile_to_delete_path,
- const base::FilePath& last_non_managed_profile_path,
+ const base::FilePath& last_non_supervised_profile_path,
const CreateCallback& original_callback,
Profile* loaded_profile,
Profile::CreateStatus status) {
@@ -1267,7 +1269,7 @@ void ProfileManager::OnNewActiveProfileLoaded(
// Only run the code if the profile initialization has finished completely.
if (status == Profile::CREATE_STATUS_INITIALIZED) {
- if (IsProfileMarkedForDeletion(last_non_managed_profile_path)) {
+ if (IsProfileMarkedForDeletion(last_non_supervised_profile_path)) {
// If the profile we tried to load as the next active profile has been
// deleted, then retry deleting this profile to redo the logic to load
// the next available profile.
@@ -1276,7 +1278,7 @@ void ProfileManager::OnNewActiveProfileLoaded(
// Update the local state as promised in the ScheduleProfileForDeletion.
g_browser_process->local_state()->SetString(
prefs::kProfileLastUsed,
- last_non_managed_profile_path.BaseName().MaybeAsASCII());
+ last_non_supervised_profile_path.BaseName().MaybeAsASCII());
FinishDeletingProfile(profile_to_delete_path);
}
}
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index d71c1d7..02334bf 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -86,7 +86,7 @@ class ProfileManager : public base::NonThreadSafe,
const CreateCallback& callback,
const base::string16& name,
const base::string16& icon_url,
- const std::string& managed_user_id);
+ const std::string& supervised_user_id);
// Returns true if the profile pointer is known to point to an existing
// profile.
@@ -134,7 +134,7 @@ class ProfileManager : public base::NonThreadSafe,
const base::string16& name,
const base::string16& icon_url,
const CreateCallback& callback,
- const std::string& managed_user_id);
+ const std::string& supervised_user_id);
// Returns the full path to be used for guest profiles.
static base::FilePath GetGuestProfilePath();
@@ -298,10 +298,11 @@ class ProfileManager : public base::NonThreadSafe,
// If the |loaded_profile| has been loaded successfully (according to
// |status|) and isn't already scheduled for deletion, then finishes adding
// |profile_to_delete_dir| to the queue of profiles to be deleted, and updates
- // the kProfileLastUsed preference based on |last_non_managed_profile_path|.
+ // the kProfileLastUsed preference based on
+ // |last_non_supervised_profile_path|.
void OnNewActiveProfileLoaded(
const base::FilePath& profile_to_delete_path,
- const base::FilePath& last_non_managed_profile_path,
+ const base::FilePath& last_non_supervised_profile_path,
const CreateCallback& original_callback,
Profile* loaded_profile,
Profile::CreateStatus status);
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index a0f1660..50e2760 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -120,7 +120,7 @@ class ProfileManagerTest : public testing::Test {
// Helper function to create a profile with |name| for a profile |manager|.
void CreateProfileAsync(ProfileManager* manager,
const std::string& name,
- bool is_managed,
+ bool is_supervised,
MockObserver* mock_observer) {
manager->CreateProfileAsync(
temp_dir_.path().AppendASCII(name),
@@ -128,7 +128,7 @@ class ProfileManagerTest : public testing::Test {
base::Unretained(mock_observer)),
base::UTF8ToUTF16(name),
base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(0)),
- is_managed ? "Dummy ID" : std::string());
+ is_supervised ? "Dummy ID" : std::string());
}
// Helper function to add a profile with |profile_name| to
@@ -302,7 +302,7 @@ TEST_F(ProfileManagerTest, CreateProfilesAsync) {
}
TEST_F(ProfileManagerTest, CreateProfileAsyncCheckOmitted) {
- std::string name = "Managed Profile";
+ std::string name = "0 Supervised Profile";
MockObserver mock_observer;
EXPECT_CALL(mock_observer, OnProfileCreated(
@@ -316,15 +316,15 @@ TEST_F(ProfileManagerTest, CreateProfileAsyncCheckOmitted) {
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1u, cache.GetNumberOfProfiles());
- // Managed profiles should start out omitted from the profile list.
+ // Supervised profiles should start out omitted from the profile list.
EXPECT_TRUE(cache.IsOmittedProfileAtIndex(0));
- name = "Regular Profile";
+ name = "1 Regular Profile";
CreateProfileAsync(profile_manager, name, false, &mock_observer);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(2u, cache.GetNumberOfProfiles());
- // Non-managed profiles should be included in the profile list.
+ // Non-supervised profiles should be included in the profile list.
EXPECT_FALSE(cache.IsOmittedProfileAtIndex(1));
}
@@ -333,26 +333,29 @@ TEST_F(ProfileManagerTest, AddProfileToCacheCheckOmitted) {
ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
EXPECT_EQ(0u, cache.GetNumberOfProfiles());
- const base::FilePath managed_path = temp_dir_.path().AppendASCII("Managed");
- TestingProfile* managed_profile = new TestingProfile(managed_path, NULL);
- managed_profile->GetPrefs()->SetString(prefs::kManagedUserId, "An ID");
+ const base::FilePath supervised_path =
+ temp_dir_.path().AppendASCII("Supervised");
+ TestingProfile* supervised_profile =
+ new TestingProfile(supervised_path, NULL);
+ supervised_profile->GetPrefs()->SetString(prefs::kSupervisedUserId, "An ID");
// RegisterTestingProfile adds the profile to the cache and takes ownership.
- profile_manager->RegisterTestingProfile(managed_profile, true, false);
+ profile_manager->RegisterTestingProfile(supervised_profile, true, false);
EXPECT_EQ(1u, cache.GetNumberOfProfiles());
EXPECT_TRUE(cache.IsOmittedProfileAtIndex(0));
- const base::FilePath nonmanaged_path = temp_dir_.path().AppendASCII(
- "Non-Managed");
- TestingProfile* nonmanaged_profile = new TestingProfile(nonmanaged_path,
- NULL);
- profile_manager->RegisterTestingProfile(nonmanaged_profile, true, false);
+ const base::FilePath nonsupervised_path = temp_dir_.path().AppendASCII(
+ "Non-Supervised");
+ TestingProfile* nonsupervised_profile = new TestingProfile(nonsupervised_path,
+ NULL);
+ profile_manager->RegisterTestingProfile(nonsupervised_profile, true, false);
EXPECT_EQ(2u, cache.GetNumberOfProfiles());
- size_t managed_index = cache.GetIndexOfProfileWithPath(managed_path);
- EXPECT_TRUE(cache.IsOmittedProfileAtIndex(managed_index));
- size_t nonmanaged_index = cache.GetIndexOfProfileWithPath(nonmanaged_path);
- EXPECT_FALSE(cache.IsOmittedProfileAtIndex(nonmanaged_index));
+ size_t supervised_index = cache.GetIndexOfProfileWithPath(supervised_path);
+ EXPECT_TRUE(cache.IsOmittedProfileAtIndex(supervised_index));
+ size_t nonsupervised_index =
+ cache.GetIndexOfProfileWithPath(nonsupervised_path);
+ EXPECT_FALSE(cache.IsOmittedProfileAtIndex(nonsupervised_index));
}
TEST_F(ProfileManagerTest, GetGuestProfilePath) {
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index 6dd3555..b68ad00 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -25,12 +25,12 @@ const int kMaximumDaysOfDisuse = 4 * 7; // Should be integral number of weeks.
struct ProfileCounts {
size_t total;
size_t signedin;
- size_t managed;
+ size_t supervised;
size_t unused;
size_t gaia_icon;
ProfileCounts()
- : total(0), signedin(0), managed(0), unused(0), gaia_icon(0) {}
+ : total(0), signedin(0), supervised(0), unused(0), gaia_icon(0) {}
};
ProfileMetrics::ProfileType GetProfileType(
@@ -72,8 +72,8 @@ bool CountProfileInformation(ProfileManager* manager, ProfileCounts* counts) {
if (info_cache.GetProfileActiveTimeAtIndex(i) < oldest) {
counts->unused++;
} else {
- if (info_cache.ProfileIsManagedAtIndex(i))
- counts->managed++;
+ if (info_cache.ProfileIsSupervisedAtIndex(i))
+ counts->supervised++;
if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) {
counts->signedin++;
if (info_cache.IsUsingGAIAPictureOfProfileAtIndex(i))
@@ -142,9 +142,9 @@ void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager) {
// Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests.
if (success) {
UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles",
- counts.managed);
+ counts.supervised);
UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles",
- 100 * counts.managed / counts.total);
+ 100 * counts.supervised / counts.total);
UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles",
counts.signedin);
UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfUnusedProfiles",
@@ -391,7 +391,7 @@ void ProfileMetrics::LogProfileLaunch(Profile* profile) {
GetProfileType(profile_path),
NUM_PROFILE_TYPE_METRICS);
- if (profile->IsManaged()) {
+ if (profile->IsSupervised()) {
content::RecordAction(
base::UserMetricsAction("ManagedMode_NewManagedUserWindow"));
}