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

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

Issue 561713002: ash: Add checks for supervised users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Default flag value set in user class constructor. Created 6 years, 3 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 | « ash/system/tray/system_tray_delegate.h ('k') | ash/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/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
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
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 (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
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
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_delegate.h ('k') | ash/system/user/user_card_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698