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

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

Issue 10389193: Add user_info_ NULL check in case of guest mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray_delegate.h" 8 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/system/tray/tray_constants.h" 9 #include "ash/system/tray/tray_constants.h"
10 #include "ash/system/tray/tray_item_view.h" 10 #include "ash/system/tray/tray_item_view.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 return size; 218 return size;
219 } 219 }
220 220
221 virtual void Layout() OVERRIDE { 221 virtual void Layout() OVERRIDE {
222 views::View::Layout(); 222 views::View::Layout();
223 if (bounds().IsEmpty()) 223 if (bounds().IsEmpty())
224 return; 224 return;
225 225
226 container_->SetBoundsRect(gfx::Rect(size())); 226 container_->SetBoundsRect(gfx::Rect(size()));
227 if (signout_) { 227 if (signout_ && user_info_) {
228 gfx::Rect signout_bounds(signout_->GetPreferredSize()); 228 gfx::Rect signout_bounds(signout_->GetPreferredSize());
229 signout_bounds = bounds().Center(signout_bounds.size()); 229 signout_bounds = bounds().Center(signout_bounds.size());
230 signout_bounds.set_x(width() - signout_bounds.width() - 230 signout_bounds.set_x(width() - signout_bounds.width() -
231 kTrayPopupPaddingHorizontal); 231 kTrayPopupPaddingHorizontal);
232 signout_->SetBoundsRect(signout_bounds); 232 signout_->SetBoundsRect(signout_bounds);
233 233
234 gfx::Rect usercard_bounds(user_info_->GetPreferredSize()); 234 gfx::Rect usercard_bounds(user_info_->GetPreferredSize());
235 usercard_bounds.set_width(signout_bounds.x()); 235 usercard_bounds.set_width(signout_bounds.x());
236 user_info_->SetBoundsRect(usercard_bounds); 236 user_info_->SetBoundsRect(usercard_bounds);
237 } else { 237 } else if (signout_) {
238 signout_->SetBoundsRect(gfx::Rect(size()));
239 } else if (user_info_) {
238 user_info_->SetBoundsRect(gfx::Rect(size())); 240 user_info_->SetBoundsRect(gfx::Rect(size()));
239 } 241 }
240 } 242 }
241 243
242 user::LoginStatus login_; 244 user::LoginStatus login_;
243 245
244 TrayPopupTextButtonContainer* container_; 246 TrayPopupTextButtonContainer* container_;
245 views::View* user_info_; 247 views::View* user_info_;
246 views::Label* username_; 248 views::Label* username_;
247 views::Label* email_; 249 views::Label* email_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 308 }
307 309
308 void TrayUser::OnUserUpdate() { 310 void TrayUser::OnUserUpdate() {
309 avatar_->SetImage( 311 avatar_->SetImage(
310 ash::Shell::GetInstance()->tray_delegate()->GetUserImage(), 312 ash::Shell::GetInstance()->tray_delegate()->GetUserImage(),
311 gfx::Size(kUserIconSize, kUserIconSize)); 313 gfx::Size(kUserIconSize, kUserIconSize));
312 } 314 }
313 315
314 } // namespace internal 316 } // namespace internal
315 } // namespace ash 317 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698