| 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/system/user/tray_user.h" | 5 #include "ash/system/user/tray_user.h" |
| 6 | 6 |
| 7 #include "ash/session/session_controller.h" | 7 #include "ash/session/session_controller.h" |
| 8 #include "ash/shelf/wm_shelf_util.h" | 8 #include "ash/shelf/wm_shelf_util.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" |
| 10 #include "ash/strings/grit/ash_strings.h" | 11 #include "ash/strings/grit/ash_strings.h" |
| 11 #include "ash/system/tray/system_tray.h" | 12 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/system/tray/system_tray_delegate.h" | 13 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 14 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/system/tray/tray_item_view.h" | 15 #include "ash/system/tray/tray_item_view.h" |
| 15 #include "ash/system/tray/tray_utils.h" | 16 #include "ash/system/tray/tray_utils.h" |
| 16 #include "ash/system/user/rounded_image_view.h" | 17 #include "ash/system/user/rounded_image_view.h" |
| 17 #include "ash/system/user/user_view.h" | 18 #include "ash/system/user/user_view.h" |
| 18 #include "ash/wm_shell.h" | |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "components/signin/core/account_id/account_id.h" | 21 #include "components/signin/core/account_id/account_id.h" |
| 22 #include "components/user_manager/user_info.h" | 22 #include "components/user_manager/user_info.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
| 25 #include "ui/views/border.h" | 25 #include "ui/views/border.h" |
| 26 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
| 27 #include "ui/views/layout/box_layout.h" | 27 #include "ui/views/layout/box_layout.h" |
| 28 #include "ui/views/view.h" | 28 #include "ui/views/view.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 views::View* TrayUser::CreateDefaultView(LoginStatus status) { | 73 views::View* TrayUser::CreateDefaultView(LoginStatus status) { |
| 74 if (status == LoginStatus::NOT_LOGGED_IN) | 74 if (status == LoginStatus::NOT_LOGGED_IN) |
| 75 return nullptr; | 75 return nullptr; |
| 76 const SessionController* const session_controller = | 76 const SessionController* const session_controller = |
| 77 Shell::Get()->session_controller(); | 77 Shell::Get()->session_controller(); |
| 78 | 78 |
| 79 // If the screen is locked or a system modal dialog box is shown, show only | 79 // If the screen is locked or a system modal dialog box is shown, show only |
| 80 // the currently active user. | 80 // the currently active user. |
| 81 if (user_index_ && (session_controller->IsUserSessionBlocked() || | 81 if (user_index_ && (session_controller->IsUserSessionBlocked() || |
| 82 WmShell::Get()->IsSystemModalWindowOpen())) | 82 ShellPort::Get()->IsSystemModalWindowOpen())) |
| 83 return nullptr; | 83 return nullptr; |
| 84 | 84 |
| 85 CHECK(user_ == nullptr); | 85 CHECK(user_ == nullptr); |
| 86 | 86 |
| 87 int logged_in_users = session_controller->NumberOfLoggedInUsers(); | 87 int logged_in_users = session_controller->NumberOfLoggedInUsers(); |
| 88 | 88 |
| 89 // Do not show more UserView's then there are logged in users. | 89 // Do not show more UserView's then there are logged in users. |
| 90 if (user_index_ >= logged_in_users) | 90 if (user_index_ >= logged_in_users) |
| 91 return nullptr; | 91 return nullptr; |
| 92 | 92 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // Unit tests might come here with no images for some users. | 247 // Unit tests might come here with no images for some users. |
| 248 if (avatar_->size().IsEmpty()) | 248 if (avatar_->size().IsEmpty()) |
| 249 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); | 249 avatar_->SetSize(gfx::Size(kTrayItemSize, kTrayItemSize)); |
| 250 } | 250 } |
| 251 | 251 |
| 252 void TrayUser::UpdateLayoutOfItem() { | 252 void TrayUser::UpdateLayoutOfItem() { |
| 253 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); | 253 UpdateAfterShelfAlignmentChange(system_tray()->shelf_alignment()); |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace ash | 256 } // namespace ash |
| OLD | NEW |