OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/common/system/user/tray_user.h" | 5 #include "ash/common/system/user/tray_user.h" |
6 | 6 |
7 #include "ash/common/session/session_controller.h" | 7 #include "ash/common/session/session_controller.h" |
8 #include "ash/common/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
10 #include "ash/common/system/tray/system_tray_delegate.h" | 10 #include "ash/common/system/tray/system_tray_delegate.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 void TrayUser::UpdateAvatarImage(LoginStatus status) { | 239 void TrayUser::UpdateAvatarImage(LoginStatus status) { |
240 const SessionController* const session_controller = | 240 const SessionController* const session_controller = |
241 Shell::Get()->session_controller(); | 241 Shell::Get()->session_controller(); |
242 if (!avatar_ || user_index_ >= session_controller->NumberOfLoggedInUsers()) | 242 if (!avatar_ || user_index_ >= session_controller->NumberOfLoggedInUsers()) |
243 return; | 243 return; |
244 | 244 |
245 const mojom::UserSession* const user_session = | 245 const mojom::UserSession* const user_session = |
246 session_controller->GetUserSession(user_index_); | 246 session_controller->GetUserSession(user_index_); |
247 CHECK(user_session); | 247 CHECK(user_session); |
248 // TODO(xiyuan); HiDpi avatar support. http://crbug.com/702689 | 248 avatar_->SetImage(user_session->avatar, |
249 avatar_->SetImage(gfx::ImageSkia::CreateFrom1xBitmap(user_session->avatar), | |
250 gfx::Size(kTrayItemSize, kTrayItemSize)); | 249 gfx::Size(kTrayItemSize, kTrayItemSize)); |
251 | 250 |
252 // Unit tests might come here with no images for some users. | 251 // Unit tests might come here with no images for some users. |
253 if (avatar_->size().IsEmpty()) | 252 if (avatar_->size().IsEmpty()) |
254 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); | 253 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); |
255 } | 254 } |
256 | 255 |
257 void TrayUser::UpdateLayoutOfItem() { | 256 void TrayUser::UpdateLayoutOfItem() { |
258 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); | 257 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); |
259 } | 258 } |
260 | 259 |
261 } // namespace ash | 260 } // namespace ash |
OLD | NEW |