| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 user_card_area.set_width(std::max(0, remaining_width)); | 464 user_card_area.set_width(std::max(0, remaining_width)); |
| 464 user_card_->SetBoundsRect(user_card_area); | 465 user_card_->SetBoundsRect(user_card_area); |
| 465 } else if (user_card_) { | 466 } else if (user_card_) { |
| 466 user_card_->SetBoundsRect(contents_area); | 467 user_card_->SetBoundsRect(contents_area); |
| 467 } else if (logout_button_) { | 468 } else if (logout_button_) { |
| 468 logout_button_->SetBoundsRect(contents_area); | 469 logout_button_->SetBoundsRect(contents_area); |
| 469 } | 470 } |
| 470 } | 471 } |
| 471 | 472 |
| 472 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 473 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| 473 if (sender == logout_button_) | 474 if (sender == logout_button_) { |
| 474 ash::Shell::GetInstance()->system_tray_delegate()->SignOut(); | 475 ash::Shell::GetInstance()->system_tray_delegate()->SignOut(); |
| 475 else if (sender == profile_picture_) | 476 } else if (sender == profile_picture_) { |
| 476 ash::Shell::GetInstance()->system_tray_delegate()->ChangeProfilePicture(); | 477 if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) |
| 477 else | 478 ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); |
| 479 else |
| 480 ash::Shell::GetInstance()->system_tray_delegate()->ChangeProfilePicture(); |
| 481 } else { |
| 478 NOTREACHED(); | 482 NOTREACHED(); |
| 483 } |
| 479 } | 484 } |
| 480 | 485 |
| 481 void UserView::AddLogoutButton(ash::user::LoginStatus login) { | 486 void UserView::AddLogoutButton(ash::user::LoginStatus login) { |
| 482 // A user should not be able to modify logged-in state when screen is | 487 // A user should not be able to modify logged-in state when screen is |
| 483 // locked. | 488 // locked. |
| 484 if (login == ash::user::LOGGED_IN_LOCKED) | 489 if (login == ash::user::LOGGED_IN_LOCKED) |
| 485 return; | 490 return; |
| 486 | 491 |
| 487 const base::string16 title = ash::user::GetLocalizedSignOutStringForStatus( | 492 const base::string16 title = ash::user::GetLocalizedSignOutStringForStatus( |
| 488 login, true); | 493 login, true); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 // Check for null to avoid crbug.com/150944. | 672 // Check for null to avoid crbug.com/150944. |
| 668 if (avatar_) { | 673 if (avatar_) { |
| 669 avatar_->SetImage( | 674 avatar_->SetImage( |
| 670 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), | 675 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), |
| 671 gfx::Size(kUserIconSize, kUserIconSize)); | 676 gfx::Size(kUserIconSize, kUserIconSize)); |
| 672 } | 677 } |
| 673 } | 678 } |
| 674 | 679 |
| 675 } // namespace internal | 680 } // namespace internal |
| 676 } // namespace ash | 681 } // namespace ash |
| OLD | NEW |