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..afe467c78416acee54c3efd5118647a7f66fe940 100644 |
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc |
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc |
@@ -6,7 +6,7 @@ |
#include <stddef.h> |
-#include <vector> |
+#include <algorithm> |
tapted
2016/01/31 23:04:37
but you should keep std::vector here (as well as a
|
#include "apps/custom_launcher_page_contents.h" |
#include "base/callback.h" |
@@ -20,7 +20,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 +108,20 @@ 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(); |
+ std::sort(entries.begin(), entries.end(), |
+ ProfileAttributesEntry::SortComparator( |
+ ProfileAttributesEntry::SortComparator::GetCollator().get())); |
+ for (const auto& entry : entries) { |
lwchkg
2016/01/31 19:12:22
Should remove the & because the underlying data ar
|
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 +204,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 +230,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 +335,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()); |