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 "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 5 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 separator_ = new views::Separator(views::Separator::HORIZONTAL); | 740 separator_ = new views::Separator(views::Separator::HORIZONTAL); |
741 AddChildView(separator_); | 741 AddChildView(separator_); |
742 buttons_view_ = add_profile_link; | 742 buttons_view_ = add_profile_link; |
743 AddChildView(buttons_view_); | 743 AddChildView(buttons_view_); |
744 } | 744 } |
745 } | 745 } |
746 | 746 |
747 void AvatarMenuBubbleView::InitManagedUserContents( | 747 void AvatarMenuBubbleView::InitManagedUserContents( |
748 AvatarMenu* avatar_menu) { | 748 AvatarMenu* avatar_menu) { |
749 // Show the profile of the managed user. | 749 // Show the profile of the managed user. |
750 size_t active_index = avatar_menu->GetActiveProfileIndex(); | 750 const AvatarMenu::Item& item = avatar_menu->GetActiveProfileItem(); |
751 const AvatarMenu::Item& item = | |
752 avatar_menu->GetItemAt(active_index); | |
753 ProfileItemView* item_view = new ProfileItemView(item, | 751 ProfileItemView* item_view = new ProfileItemView(item, |
754 this, | 752 this, |
755 avatar_menu_.get()); | 753 avatar_menu_.get()); |
756 item_view->SetAccessibleName(l10n_util::GetStringFUTF16( | 754 item_view->SetAccessibleName(l10n_util::GetStringFUTF16( |
757 IDS_PROFILES_SWITCH_TO_PROFILE_ACCESSIBLE_NAME, item.name)); | 755 IDS_PROFILES_SWITCH_TO_PROFILE_ACCESSIBLE_NAME, item.name)); |
758 item_views_.push_back(item_view); | 756 item_views_.push_back(item_view); |
759 AddChildView(item_view); | 757 AddChildView(item_view); |
760 separator_ = new views::Separator(views::Separator::HORIZONTAL); | 758 separator_ = new views::Separator(views::Separator::HORIZONTAL); |
761 AddChildView(separator_); | 759 AddChildView(separator_); |
762 | 760 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 Layout(); | 802 Layout(); |
805 if (GetBubbleFrameView()) | 803 if (GetBubbleFrameView()) |
806 SizeToContents(); | 804 SizeToContents(); |
807 } | 805 } |
808 | 806 |
809 void AvatarMenuBubbleView::SetBackgroundColors() { | 807 void AvatarMenuBubbleView::SetBackgroundColors() { |
810 for (size_t i = 0; i < item_views_.size(); ++i) { | 808 for (size_t i = 0; i < item_views_.size(); ++i) { |
811 item_views_[i]->OnHighlightStateChanged(); | 809 item_views_[i]->OnHighlightStateChanged(); |
812 } | 810 } |
813 } | 811 } |
OLD | NEW |