Index: chrome/browser/ui/app_list/app_list_view_delegate.cc |
diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc |
index c26a1baf8b17c96543516b4ed8cb081af9b7f8f1..d691fbe26215588da28b047e1fe3546c22b2c247 100644 |
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc |
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc |
@@ -6,6 +6,8 @@ |
#include <stddef.h> |
+#include <algorithm> |
+#include <functional> |
#include <vector> |
#include "apps/custom_launcher_page_contents.h" |
@@ -20,7 +22,8 @@ |
#include "chrome/browser/apps/scoped_keep_alive.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chrome_notification_types.h" |
-#include "chrome/browser/profiles/profile_info_cache.h" |
+#include "chrome/browser/profiles/profile_attributes_entry.h" |
+#include "chrome/browser/profiles/profile_attributes_storage.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/search/hotword_service.h" |
#include "chrome/browser/search/hotword_service_factory.h" |
@@ -107,16 +110,19 @@ void CreateShortcutInWebAppDir( |
} |
#endif |
-void PopulateUsers(const ProfileInfoCache& profile_info, |
- const base::FilePath& active_profile_path, |
+void PopulateUsers(const base::FilePath& active_profile_path, |
app_list::AppListViewDelegate::Users* users) { |
users->clear(); |
- const size_t count = profile_info.GetNumberOfProfiles(); |
- for (size_t i = 0; i < count; ++i) { |
+ std::vector<ProfileAttributesEntry*> entries = g_browser_process-> |
+ profile_manager()->GetProfileAttributesStorage(). |
+ GetAllProfilesAttributes(); |
+ ProfileAttributesEntry::SortComparator comp; |
+ std::sort(entries.begin(), entries.end(), std::cref(comp)); |
lwchkg
2016/02/03 17:18:38
Tried a few methods for one day... most failing ex
|
+ for (const auto entry : entries) { |
app_list::AppListViewDelegate::User user; |
- user.name = profile_info.GetNameOfProfileAtIndex(i); |
- user.email = profile_info.GetUserNameOfProfileAtIndex(i); |
- user.profile_path = profile_info.GetPathOfProfileAtIndex(i); |
+ user.name = entry->GetName(); |
+ user.email = entry->GetUserName(); |
+ user.profile_path = entry->GetPath(); |
user.active = active_profile_path == user.profile_path; |
users->push_back(user); |
} |
@@ -199,7 +205,7 @@ AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller) |
} |
} |
- profile_manager->GetProfileInfoCache().AddObserver(this); |
+ profile_manager->GetProfileAttributesStorage().AddObserver(this); |
speech_ui_.reset(new app_list::SpeechUIModel); |
#if defined(GOOGLE_CHROME_BUILD) |
@@ -225,8 +231,8 @@ AppListViewDelegate::~AppListViewDelegate() { |
// by a leaky singleton. Essential shutdown work must be done by observing |
// chrome::NOTIFICATION_APP_TERMINATING. |
SetProfile(NULL); |
- g_browser_process->profile_manager()->GetProfileInfoCache().RemoveObserver( |
- this); |
+ g_browser_process->profile_manager()->GetProfileAttributesStorage(). |
+ RemoveObserver(this); |
SigninManagerFactory* factory = SigninManagerFactory::GetInstance(); |
if (factory) |
@@ -330,9 +336,7 @@ void AppListViewDelegate::SetUpProfileSwitcher() { |
return; |
// Populate the app list users. |
- PopulateUsers(g_browser_process->profile_manager()->GetProfileInfoCache(), |
- profile_->GetPath(), |
- &users_); |
+ PopulateUsers(profile_->GetPath(), &users_); |
FOR_EACH_OBSERVER( |
app_list::AppListViewDelegateObserver, observers_, OnProfilesChanged()); |