| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 | 131 |
| 132 void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 132 void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
| 133 // Only the active user is represented in the tray. | 133 // Only the active user is represented in the tray. |
| 134 if (!layout_view_) | 134 if (!layout_view_) |
| 135 return; | 135 return; |
| 136 if (GetTrayIndex() > 0) | 136 if (GetTrayIndex() > 0) |
| 137 return; | 137 return; |
| 138 bool need_label = false; | 138 bool need_label = false; |
| 139 bool need_avatar = false; | 139 bool need_avatar = false; |
| 140 SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); | |
| 141 if (delegate->IsUserSupervised()) | |
| 142 need_label = true; | |
| 143 switch (status) { | 140 switch (status) { |
| 144 case user::LOGGED_IN_LOCKED: | 141 case user::LOGGED_IN_LOCKED: |
| 145 case user::LOGGED_IN_USER: | 142 case user::LOGGED_IN_USER: |
| 146 case user::LOGGED_IN_OWNER: | 143 case user::LOGGED_IN_OWNER: |
| 147 case user::LOGGED_IN_PUBLIC: | 144 case user::LOGGED_IN_PUBLIC: |
| 148 need_avatar = true; | 145 need_avatar = true; |
| 149 break; | 146 break; |
| 150 case user::LOGGED_IN_SUPERVISED: | 147 case user::LOGGED_IN_SUPERVISED: |
| 151 need_avatar = true; | 148 need_avatar = true; |
| 152 need_label = true; | 149 need_label = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 171 label_ = NULL; | 168 label_ = NULL; |
| 172 } | 169 } |
| 173 if (need_avatar) { | 170 if (need_avatar) { |
| 174 avatar_ = new tray::RoundedImageView(kTrayAvatarCornerRadius, true); | 171 avatar_ = new tray::RoundedImageView(kTrayAvatarCornerRadius, true); |
| 175 layout_view_->AddChildView(avatar_); | 172 layout_view_->AddChildView(avatar_); |
| 176 } else { | 173 } else { |
| 177 avatar_ = NULL; | 174 avatar_ = NULL; |
| 178 } | 175 } |
| 179 } | 176 } |
| 180 | 177 |
| 181 if (delegate->IsUserSupervised()) { | 178 if (status == user::LOGGED_IN_SUPERVISED) { |
| 182 label_->SetText( | 179 label_->SetText( |
| 183 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); | 180 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); |
| 184 } else if (status == user::LOGGED_IN_GUEST) { | 181 } else if (status == user::LOGGED_IN_GUEST) { |
| 185 label_->SetText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL)); | 182 label_->SetText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL)); |
| 186 } | 183 } |
| 187 | 184 |
| 188 if (avatar_) { | 185 if (avatar_) { |
| 189 avatar_->SetCornerRadii( | 186 avatar_->SetCornerRadii( |
| 190 0, kTrayAvatarCornerRadius, kTrayAvatarCornerRadius, 0); | 187 0, kTrayAvatarCornerRadius, kTrayAvatarCornerRadius, 0); |
| 191 avatar_->SetBorder(views::Border::NullBorder()); | 188 avatar_->SetBorder(views::Border::NullBorder()); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 void TrayUser::UpdateLayoutOfItem() { | 290 void TrayUser::UpdateLayoutOfItem() { |
| 294 RootWindowController* controller = GetRootWindowController( | 291 RootWindowController* controller = GetRootWindowController( |
| 295 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | 292 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
| 296 if (controller && controller->shelf()) { | 293 if (controller && controller->shelf()) { |
| 297 UpdateAfterShelfAlignmentChange( | 294 UpdateAfterShelfAlignmentChange( |
| 298 controller->GetShelfLayoutManager()->GetAlignment()); | 295 controller->GetShelfLayoutManager()->GetAlignment()); |
| 299 } | 296 } |
| 300 } | 297 } |
| 301 | 298 |
| 302 } // namespace ash | 299 } // namespace ash |
| OLD | NEW |