Chromium Code Reviews| 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 // Make sure all representations are loaded before sending via mojo. |
|
msw
2017/03/23 20:47:51
Hmm, I wonder if there's a way to ensure we always
xiyuan
2017/03/24 05:45:19
I left this part out of traits because only caller
| |
| 66 session->avatar = *user.GetImage().bitmap(); | 66 user.GetImage().EnsureRepsForSupportedScales(); |
| 67 | |
| 68 session->avatar = user.GetImage(); | |
| 67 if (session->avatar.isNull()) { | 69 if (session->avatar.isNull()) { |
| 68 session->avatar = *ResourceBundle::GetSharedInstance() | 70 session->avatar = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 69 .GetImageSkiaNamed(IDR_PROFILE_PICTURE_LOADING) | 71 IDR_PROFILE_PICTURE_LOADING); |
| 70 ->bitmap(); | |
| 71 } | 72 } |
| 72 | 73 |
| 73 return session; | 74 return session; |
| 74 } | 75 } |
| 75 | 76 |
| 76 void DoSwitchUser(const AccountId& account_id) { | 77 void DoSwitchUser(const AccountId& account_id) { |
| 77 UserManager::Get()->SwitchActiveUser(account_id); | 78 UserManager::Get()->SwitchActiveUser(account_id); |
| 78 } | 79 } |
| 79 | 80 |
| 80 } // namespace | 81 } // namespace |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 const UserList logged_in_users = user_manager->GetLoggedInUsers(); | 288 const UserList logged_in_users = user_manager->GetLoggedInUsers(); |
| 288 std::vector<uint32_t> user_session_ids; | 289 std::vector<uint32_t> user_session_ids; |
| 289 for (auto* user : user_manager->GetLRULoggedInUsers()) { | 290 for (auto* user : user_manager->GetLRULoggedInUsers()) { |
| 290 const uint32_t user_session_id = GetSessionId(*user); | 291 const uint32_t user_session_id = GetSessionId(*user); |
| 291 DCHECK_NE(0u, user_session_id); | 292 DCHECK_NE(0u, user_session_id); |
| 292 user_session_ids.push_back(user_session_id); | 293 user_session_ids.push_back(user_session_id); |
| 293 } | 294 } |
| 294 | 295 |
| 295 session_controller_->SetUserSessionOrder(user_session_ids); | 296 session_controller_->SetUserSessionOrder(user_session_ids); |
| 296 } | 297 } |
| OLD | NEW |