Index: chrome/browser/ui/webui/options/create_profile_handler.cc |
diff --git a/chrome/browser/ui/webui/options/create_profile_handler.cc b/chrome/browser/ui/webui/options/create_profile_handler.cc |
index f88baccd631d6b44560ebe18424556d0957ccf1c..ef8c13c948225ca2de7904e9792e8f42cb9ff992 100644 |
--- a/chrome/browser/ui/webui/options/create_profile_handler.cc |
+++ b/chrome/browser/ui/webui/options/create_profile_handler.cc |
@@ -424,8 +424,11 @@ bool CreateProfileHandler::IsValidExistingManagedUserId( |
// Check if this managed user already exists on this machine. |
const ProfileInfoCache& cache = |
g_browser_process->profile_manager()->GetProfileInfoCache(); |
- for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
- if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) |
+ |
+ const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName()); |
+ for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
+ it != entries.end(); ++it) { |
+ if (existing_managed_user_id == it->managed_user_id()) |
return false; |
} |
return true; |