Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: ash/common/system/user/tray_user.cc

Issue 2770693002: ash: HiDPI user avatar for SessionController (Closed)
Patch Set: nits, and gn check Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/common/system/user/user_card_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/user/user_card_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698