Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/ui/webui/options/create_profile_handler.cc

Issue 33753002: Sooper experimental refactoring of the profile info cache. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.cc ('k') | chrome/browser/ui/webui/options/manage_profile_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698