| Index: chrome/browser/ui/webui/options/managed_user_import_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/managed_user_import_handler.cc b/chrome/browser/ui/webui/options/managed_user_import_handler.cc
|
| index 1722b6459499fe77f6a8520bc5216f18282e281f..d8f96e1e2b5165085bbca636d6f51e98667613ef 100644
|
| --- a/chrome/browser/ui/webui/options/managed_user_import_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/managed_user_import_handler.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/prefs/pref_service.h"
|
| +#include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| @@ -62,6 +63,7 @@ void ManagedUserImportHandler::GetLocalizedValues(
|
| { "managedUserImportSigninError", IDS_MANAGED_USER_IMPORT_SIGN_IN_ERROR },
|
| { "managedUserAlreadyOnThisDevice",
|
| IDS_MANAGED_USER_ALREADY_ON_THIS_DEVICE },
|
| + { "managedUserNameConflict", IDS_MANAGED_USER_NAME_CONFLICT },
|
| { "noExistingManagedUsers", IDS_MANAGED_USER_NO_EXISTING_ERROR },
|
| { "managedUserSelectAvatarTitle", IDS_MANAGED_USER_SELECT_AVATAR_TITLE },
|
| { "managedUserSelectAvatarText", IDS_MANAGED_USER_SELECT_AVATAR_TEXT },
|
| @@ -122,9 +124,20 @@ void ManagedUserImportHandler::SendExistingManagedUsers(
|
| DCHECK(dict);
|
| const ProfileInfoCache& cache =
|
| g_browser_process->profile_manager()->GetProfileInfoCache();
|
| +
|
| + // Collect the names of the local profiles.
|
| + std::vector<base::string16> profile_names_list =
|
| + ProfileInfoCache::GetProfileNames();
|
| + std::set<std::string> profile_names;
|
| + for (size_t i = 0; i < profile_names_list.size(); ++i)
|
| + profile_names.insert(UTF16ToUTF8(profile_names_list[i]));
|
| +
|
| + // Collect the ids of local supervised user profiles.
|
| std::set<std::string> managed_user_ids;
|
| - for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i)
|
| - managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i));
|
| + for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
|
| + if (cache.ProfileIsManagedAtIndex(i))
|
| + managed_user_ids.insert(cache.GetManagedUserIdOfProfileAtIndex(i));
|
| + }
|
|
|
| base::ListValue managed_users;
|
| for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
|
| @@ -157,6 +170,8 @@ void ManagedUserImportHandler::SendExistingManagedUsers(
|
| bool on_current_device =
|
| managed_user_ids.find(it.key()) != managed_user_ids.end();
|
| managed_user->SetBoolean("onCurrentDevice", on_current_device);
|
| + bool name_conflict = profile_names.find(name) != profile_names.end();
|
| + managed_user->SetBoolean("nameConflict", name_conflict);
|
|
|
| managed_users.Append(managed_user);
|
| }
|
|
|