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 "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 const Indexes& avatars_to_show) { | 1240 const Indexes& avatars_to_show) { |
1241 views::View* view = new views::View(); | 1241 views::View* view = new views::View(); |
1242 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); | 1242 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); |
1243 | 1243 |
1244 int num_avatars_to_show = avatars_to_show.size(); | 1244 int num_avatars_to_show = avatars_to_show.size(); |
1245 for (int i = 0; i < num_avatars_to_show; ++i) { | 1245 for (int i = 0; i < num_avatars_to_show; ++i) { |
1246 const size_t index = avatars_to_show[i]; | 1246 const size_t index = avatars_to_show[i]; |
1247 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); | 1247 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); |
1248 const int kSmallImageSide = 32; | 1248 const int kSmallImageSide = 32; |
1249 | 1249 |
| 1250 // Use the low-res, small default avatars in the fast user switcher, like |
| 1251 // we do in the menu bar. |
| 1252 gfx::Image item_icon; |
| 1253 bool is_rectangle; |
| 1254 AvatarMenu::GetImageForMenuButton( |
| 1255 item.profile_path, &item_icon, &is_rectangle); |
| 1256 |
1250 gfx::Image image = profiles::GetSizedAvatarIcon( | 1257 gfx::Image image = profiles::GetSizedAvatarIcon( |
1251 item.icon, true, kSmallImageSide, kSmallImageSide); | 1258 item_icon, true, kSmallImageSide, kSmallImageSide); |
1252 | 1259 |
1253 views::LabelButton* button = new BackgroundColorHoverButton( | 1260 views::LabelButton* button = new BackgroundColorHoverButton( |
1254 this, | 1261 this, |
1255 item.name, | 1262 item.name, |
1256 *image.ToImageSkia()); | 1263 *image.ToImageSkia()); |
1257 open_other_profile_indexes_map_[button] = index; | 1264 open_other_profile_indexes_map_[button] = index; |
1258 | 1265 |
1259 layout->StartRow(1, 0); | 1266 layout->StartRow(1, 0); |
1260 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 1267 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
1261 layout->StartRow(1, 0); | 1268 layout->StartRow(1, 0); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1675 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
1669 IncognitoModePrefs::DISABLED; | 1676 IncognitoModePrefs::DISABLED; |
1670 return incognito_available && !browser_->profile()->IsGuestSession(); | 1677 return incognito_available && !browser_->profile()->IsGuestSession(); |
1671 } | 1678 } |
1672 | 1679 |
1673 void ProfileChooserView::PostActionPerformed( | 1680 void ProfileChooserView::PostActionPerformed( |
1674 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1681 ProfileMetrics::ProfileDesktopMenu action_performed) { |
1675 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1682 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
1676 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1683 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
1677 } | 1684 } |
OLD | NEW |