| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ash/session_controller_client.h" | 5 #include "chrome/browser/ui/ash/session_controller_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/public/cpp/session_types.h" | 10 #include "ash/public/cpp/session_types.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 if (user_session_id == 0u) | 55 if (user_session_id == 0u) |
| 56 return nullptr; | 56 return nullptr; |
| 57 | 57 |
| 58 ash::mojom::UserSessionPtr session = ash::mojom::UserSession::New(); | 58 ash::mojom::UserSessionPtr session = ash::mojom::UserSession::New(); |
| 59 session->session_id = user_session_id; | 59 session->session_id = user_session_id; |
| 60 session->type = user.GetType(); | 60 session->type = user.GetType(); |
| 61 session->account_id = user.GetAccountId(); | 61 session->account_id = user.GetAccountId(); |
| 62 session->display_name = base::UTF16ToUTF8(user.display_name()); | 62 session->display_name = base::UTF16ToUTF8(user.display_name()); |
| 63 session->display_email = user.display_email(); | 63 session->display_email = user.display_email(); |
| 64 | 64 |
| 65 // TODO(xiyuan): Support multiple scale factor. | 65 session->avatar = user.GetImage(); |
| 66 session->avatar = *user.GetImage().bitmap(); | |
| 67 if (session->avatar.isNull()) { | 66 if (session->avatar.isNull()) { |
| 68 session->avatar = *ResourceBundle::GetSharedInstance() | 67 session->avatar = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 69 .GetImageSkiaNamed(IDR_PROFILE_PICTURE_LOADING) | 68 IDR_PROFILE_PICTURE_LOADING); |
| 70 ->bitmap(); | |
| 71 } | 69 } |
| 72 | 70 |
| 73 return session; | 71 return session; |
| 74 } | 72 } |
| 75 | 73 |
| 76 void DoSwitchUser(const AccountId& account_id) { | 74 void DoSwitchUser(const AccountId& account_id) { |
| 77 UserManager::Get()->SwitchActiveUser(account_id); | 75 UserManager::Get()->SwitchActiveUser(account_id); |
| 78 } | 76 } |
| 79 | 77 |
| 80 } // namespace | 78 } // namespace |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 const UserList logged_in_users = user_manager->GetLoggedInUsers(); | 285 const UserList logged_in_users = user_manager->GetLoggedInUsers(); |
| 288 std::vector<uint32_t> user_session_ids; | 286 std::vector<uint32_t> user_session_ids; |
| 289 for (auto* user : user_manager->GetLRULoggedInUsers()) { | 287 for (auto* user : user_manager->GetLRULoggedInUsers()) { |
| 290 const uint32_t user_session_id = GetSessionId(*user); | 288 const uint32_t user_session_id = GetSessionId(*user); |
| 291 DCHECK_NE(0u, user_session_id); | 289 DCHECK_NE(0u, user_session_id); |
| 292 user_session_ids.push_back(user_session_id); | 290 user_session_ids.push_back(user_session_id); |
| 293 } | 291 } |
| 294 | 292 |
| 295 session_controller_->SetUserSessionOrder(user_session_ids); | 293 session_controller_->SetUserSessionOrder(user_session_ids); |
| 296 } | 294 } |
| OLD | NEW |