| 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; |
| 140 switch (status) { | 143 switch (status) { |
| 141 case user::LOGGED_IN_LOCKED: | 144 case user::LOGGED_IN_LOCKED: |
| 142 case user::LOGGED_IN_USER: | 145 case user::LOGGED_IN_USER: |
| 143 case user::LOGGED_IN_OWNER: | 146 case user::LOGGED_IN_OWNER: |
| 144 case user::LOGGED_IN_PUBLIC: | 147 case user::LOGGED_IN_PUBLIC: |
| 145 need_avatar = true; | 148 need_avatar = true; |
| 146 break; | 149 break; |
| 147 case user::LOGGED_IN_SUPERVISED: | 150 case user::LOGGED_IN_SUPERVISED: |
| 148 need_avatar = true; | 151 need_avatar = true; |
| 149 need_label = true; | 152 need_label = true; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 168 label_ = NULL; | 171 label_ = NULL; |
| 169 } | 172 } |
| 170 if (need_avatar) { | 173 if (need_avatar) { |
| 171 avatar_ = new tray::RoundedImageView(kTrayAvatarCornerRadius, true); | 174 avatar_ = new tray::RoundedImageView(kTrayAvatarCornerRadius, true); |
| 172 layout_view_->AddChildView(avatar_); | 175 layout_view_->AddChildView(avatar_); |
| 173 } else { | 176 } else { |
| 174 avatar_ = NULL; | 177 avatar_ = NULL; |
| 175 } | 178 } |
| 176 } | 179 } |
| 177 | 180 |
| 178 if (status == user::LOGGED_IN_SUPERVISED) { | 181 if (status == user::LOGGED_IN_SUPERVISED || delegate->IsUserSupervised()) { |
| 179 label_->SetText( | 182 label_->SetText( |
| 180 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); | 183 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); |
| 181 } else if (status == user::LOGGED_IN_GUEST) { | 184 } else if (status == user::LOGGED_IN_GUEST) { |
| 182 label_->SetText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL)); | 185 label_->SetText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL)); |
| 183 } | 186 } |
| 184 | 187 |
| 185 if (avatar_) { | 188 if (avatar_) { |
| 186 avatar_->SetCornerRadii( | 189 avatar_->SetCornerRadii( |
| 187 0, kTrayAvatarCornerRadius, kTrayAvatarCornerRadius, 0); | 190 0, kTrayAvatarCornerRadius, kTrayAvatarCornerRadius, 0); |
| 188 avatar_->SetBorder(views::Border::NullBorder()); | 191 avatar_->SetBorder(views::Border::NullBorder()); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 void TrayUser::UpdateLayoutOfItem() { | 293 void TrayUser::UpdateLayoutOfItem() { |
| 291 RootWindowController* controller = GetRootWindowController( | 294 RootWindowController* controller = GetRootWindowController( |
| 292 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); | 295 system_tray()->GetWidget()->GetNativeWindow()->GetRootWindow()); |
| 293 if (controller && controller->shelf()) { | 296 if (controller && controller->shelf()) { |
| 294 UpdateAfterShelfAlignmentChange( | 297 UpdateAfterShelfAlignmentChange( |
| 295 controller->GetShelfLayoutManager()->GetAlignment()); | 298 controller->GetShelfLayoutManager()->GetAlignment()); |
| 296 } | 299 } |
| 297 } | 300 } |
| 298 | 301 |
| 299 } // namespace ash | 302 } // namespace ash |
| OLD | NEW |