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 <algorithm> | 7 #include <algorithm> |
8 #include <climits> | 8 #include <climits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_delegate.h" |
12 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
13 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
14 #include "ash/system/tray/system_tray_notifier.h" | 15 #include "ash/system/tray/system_tray_notifier.h" |
15 #include "ash/system/tray/tray_constants.h" | 16 #include "ash/system/tray/tray_constants.h" |
16 #include "ash/system/tray/tray_item_view.h" | 17 #include "ash/system/tray/tray_item_view.h" |
17 #include "ash/system/tray/tray_popup_label_button.h" | 18 #include "ash/system/tray/tray_popup_label_button.h" |
18 #include "ash/system/tray/tray_popup_label_button_border.h" | 19 #include "ash/system/tray/tray_popup_label_button_border.h" |
19 #include "base/i18n/rtl.h" | 20 #include "base/i18n/rtl.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
21 #include "base/memory/scoped_vector.h" | 22 #include "base/memory/scoped_vector.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 user_card_area.set_width(std::max(0, remaining_width)); | 459 user_card_area.set_width(std::max(0, remaining_width)); |
459 user_card_->SetBoundsRect(user_card_area); | 460 user_card_->SetBoundsRect(user_card_area); |
460 } else if (user_card_) { | 461 } else if (user_card_) { |
461 user_card_->SetBoundsRect(contents_area); | 462 user_card_->SetBoundsRect(contents_area); |
462 } else if (logout_button_) { | 463 } else if (logout_button_) { |
463 logout_button_->SetBoundsRect(contents_area); | 464 logout_button_->SetBoundsRect(contents_area); |
464 } | 465 } |
465 } | 466 } |
466 | 467 |
467 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 468 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
468 if (sender == logout_button_) | 469 if (sender == logout_button_) { |
469 ash::Shell::GetInstance()->system_tray_delegate()->SignOut(); | 470 ash::Shell::GetInstance()->system_tray_delegate()->SignOut(); |
470 else if (sender == profile_picture_) | 471 } else if (sender == profile_picture_) { |
471 ash::Shell::GetInstance()->system_tray_delegate()->ChangeProfilePicture(); | 472 if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) |
472 else | 473 ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); |
| 474 else |
| 475 ash::Shell::GetInstance()->system_tray_delegate()->ChangeProfilePicture(); |
| 476 } else { |
473 NOTREACHED(); | 477 NOTREACHED(); |
| 478 } |
474 } | 479 } |
475 | 480 |
476 void UserView::AddLogoutButton(ash::user::LoginStatus login) { | 481 void UserView::AddLogoutButton(ash::user::LoginStatus login) { |
477 // A user should not be able to modify logged-in state when screen is | 482 // A user should not be able to modify logged-in state when screen is |
478 // locked. | 483 // locked. |
479 if (login == ash::user::LOGGED_IN_LOCKED) | 484 if (login == ash::user::LOGGED_IN_LOCKED) |
480 return; | 485 return; |
481 | 486 |
482 const base::string16 title = ash::user::GetLocalizedSignOutStringForStatus( | 487 const base::string16 title = ash::user::GetLocalizedSignOutStringForStatus( |
483 login, true); | 488 login, true); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 // Check for null to avoid crbug.com/150944. | 667 // Check for null to avoid crbug.com/150944. |
663 if (avatar_) { | 668 if (avatar_) { |
664 avatar_->SetImage( | 669 avatar_->SetImage( |
665 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), | 670 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), |
666 gfx::Size(kUserIconSize, kUserIconSize)); | 671 gfx::Size(kUserIconSize, kUserIconSize)); |
667 } | 672 } |
668 } | 673 } |
669 | 674 |
670 } // namespace internal | 675 } // namespace internal |
671 } // namespace ash | 676 } // namespace ash |
OLD | NEW |