OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/create_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/create_profile_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 Profile* profile = Profile::FromWebUI(web_ui()); | 418 Profile* profile = Profile::FromWebUI(web_ui()); |
419 const DictionaryValue* dict = | 419 const DictionaryValue* dict = |
420 ManagedUserSyncServiceFactory::GetForProfile(profile)->GetManagedUsers(); | 420 ManagedUserSyncServiceFactory::GetForProfile(profile)->GetManagedUsers(); |
421 if (!dict->HasKey(existing_managed_user_id)) | 421 if (!dict->HasKey(existing_managed_user_id)) |
422 return false; | 422 return false; |
423 | 423 |
424 // Check if this managed user already exists on this machine. | 424 // Check if this managed user already exists on this machine. |
425 const ProfileInfoCache& cache = | 425 const ProfileInfoCache& cache = |
426 g_browser_process->profile_manager()->GetProfileInfoCache(); | 426 g_browser_process->profile_manager()->GetProfileInfoCache(); |
427 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 427 |
428 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) | 428 const std::vector<ProfileInfoEntry> entries(cache.GetProfilesSortedByName()); |
| 429 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
| 430 it != entries.end(); ++it) { |
| 431 if (existing_managed_user_id == it->managed_user_id()) |
429 return false; | 432 return false; |
430 } | 433 } |
431 return true; | 434 return true; |
432 } | 435 } |
433 | 436 |
434 } // namespace options | 437 } // namespace options |
OLD | NEW |