Public pods move to the beginning of user list on sign-in.

BUG=326651

Review URL: https://codereview.chromium.org/150203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247955 0039d316-1c4b-4281-b951-d872f2087c98
parent 7456448f
...@@ -1227,6 +1227,7 @@ void SigninScreenHandler::SendUserList(bool animated) { ...@@ -1227,6 +1227,7 @@ void SigninScreenHandler::SendUserList(bool animated) {
size_t non_owner_count = 0; size_t non_owner_count = 0;
base::ListValue users_list; base::ListValue users_list;
size_t first_non_public_account_index = 0;
const UserList& users = delegate_->GetUsers(); const UserList& users = delegate_->GetUsers();
// TODO(nkostylev): Move to a separate method in UserManager. // TODO(nkostylev): Move to a separate method in UserManager.
...@@ -1235,11 +1236,10 @@ void SigninScreenHandler::SendUserList(bool animated) { ...@@ -1235,11 +1236,10 @@ void SigninScreenHandler::SendUserList(bool animated) {
UserManager::Get()->IsUserLoggedIn(); UserManager::Get()->IsUserLoggedIn();
bool single_user = users.size() == 1; bool single_user = users.size() == 1;
std::string owner;
chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner);
for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) {
const std::string& email = (*it)->email(); const std::string& email = (*it)->email();
std::string owner;
chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner);
bool is_owner = (email == owner); bool is_owner = (email == owner);
if (non_owner_count < max_non_owner_users || is_owner) { if (non_owner_count < max_non_owner_users || is_owner) {
...@@ -1259,7 +1259,11 @@ void SigninScreenHandler::SendUserList(bool animated) { ...@@ -1259,7 +1259,11 @@ void SigninScreenHandler::SendUserList(bool animated) {
!signed_in && !signed_in &&
!is_signin_to_add); !is_signin_to_add);
users_list.Append(user_dict); // public accounts come first in the list
if (is_public_account)
users_list.Insert(first_non_public_account_index++, user_dict);
else
users_list.Append(user_dict);
if (!is_owner) if (!is_owner)
++non_owner_count; ++non_owner_count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment