| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/user_card_view.h" | 5 #include "ash/system/user/user_card_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/session/session_state_delegate.h" | 10 #include "ash/session/session_state_delegate.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 line_count * line_height + link_extra_height + insets.height()); | 332 line_count * line_height + link_extra_height + insets.height()); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace | 335 } // namespace |
| 336 | 336 |
| 337 UserCardView::UserCardView(user::LoginStatus login_status, | 337 UserCardView::UserCardView(user::LoginStatus login_status, |
| 338 int max_width, | 338 int max_width, |
| 339 int multiprofile_index) { | 339 int multiprofile_index) { |
| 340 SetLayoutManager(new views::BoxLayout( | 340 SetLayoutManager(new views::BoxLayout( |
| 341 views::BoxLayout::kHorizontal, 0, 0, kTrayPopupPaddingBetweenItems)); | 341 views::BoxLayout::kHorizontal, 0, 0, kTrayPopupPaddingBetweenItems)); |
| 342 switch (login_status) { | 342 if (login_status == user::LOGGED_IN_PUBLIC) { |
| 343 case user::LOGGED_IN_RETAIL_MODE: | 343 AddPublicModeUserContent(max_width); |
| 344 AddRetailModeUserContent(); | 344 } else { |
| 345 break; | 345 AddUserContent(login_status, multiprofile_index); |
| 346 case user::LOGGED_IN_PUBLIC: | |
| 347 AddPublicModeUserContent(max_width); | |
| 348 break; | |
| 349 default: | |
| 350 AddUserContent(login_status, multiprofile_index); | |
| 351 break; | |
| 352 } | 346 } |
| 353 } | 347 } |
| 354 | 348 |
| 355 UserCardView::~UserCardView() {} | 349 UserCardView::~UserCardView() {} |
| 356 | 350 |
| 357 void UserCardView::AddRetailModeUserContent() { | |
| 358 views::Label* details = new views::Label; | |
| 359 details->SetText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_KIOSK_LABEL)); | |
| 360 details->SetBorder(views::Border::CreateEmptyBorder(0, 4, 0, 1)); | |
| 361 details->SetHorizontalAlignment(gfx::ALIGN_LEFT); | |
| 362 AddChildView(details); | |
| 363 } | |
| 364 | |
| 365 void UserCardView::AddPublicModeUserContent(int max_width) { | 351 void UserCardView::AddPublicModeUserContent(int max_width) { |
| 366 views::View* icon = CreateIcon(user::LOGGED_IN_PUBLIC, 0); | 352 views::View* icon = CreateIcon(user::LOGGED_IN_PUBLIC, 0); |
| 367 AddChildView(icon); | 353 AddChildView(icon); |
| 368 int details_max_width = max_width - icon->GetPreferredSize().width() - | 354 int details_max_width = max_width - icon->GetPreferredSize().width() - |
| 369 kTrayPopupPaddingBetweenItems; | 355 kTrayPopupPaddingBetweenItems; |
| 370 AddChildView(new PublicAccountUserDetails(details_max_width)); | 356 AddChildView(new PublicAccountUserDetails(details_max_width)); |
| 371 } | 357 } |
| 372 | 358 |
| 373 void UserCardView::AddUserContent(user::LoginStatus login_status, | 359 void UserCardView::AddUserContent(user::LoginStatus login_status, |
| 374 int multiprofile_index) { | 360 int multiprofile_index) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 content::BrowserContext* context = | 455 content::BrowserContext* context = |
| 470 delegate->GetBrowserContextByIndex(multiprofile_index); | 456 delegate->GetBrowserContextByIndex(multiprofile_index); |
| 471 icon->SetImage(delegate->GetUserInfo(context)->GetImage(), | 457 icon->SetImage(delegate->GetUserInfo(context)->GetImage(), |
| 472 gfx::Size(kTrayAvatarSize, kTrayAvatarSize)); | 458 gfx::Size(kTrayAvatarSize, kTrayAvatarSize)); |
| 473 } | 459 } |
| 474 return icon; | 460 return icon; |
| 475 } | 461 } |
| 476 | 462 |
| 477 } // namespace tray | 463 } // namespace tray |
| 478 } // namespace ash | 464 } // namespace ash |
| OLD | NEW |