Chromium Code Reviews| 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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); | 1285 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); |
| 1286 const int kSmallImageSide = 32; | 1286 const int kSmallImageSide = 32; |
| 1287 | 1287 |
| 1288 // Use the low-res, small default avatars in the fast user switcher, like | 1288 // Use the low-res, small default avatars in the fast user switcher, like |
| 1289 // we do in the menu bar. | 1289 // we do in the menu bar. |
| 1290 gfx::Image item_icon; | 1290 gfx::Image item_icon; |
| 1291 bool is_rectangle; | 1291 bool is_rectangle; |
| 1292 AvatarMenu::GetImageForMenuButton( | 1292 AvatarMenu::GetImageForMenuButton( |
| 1293 item.profile_path, &item_icon, &is_rectangle); | 1293 item.profile_path, &item_icon, &is_rectangle); |
| 1294 | 1294 |
| 1295 base::string16 title = item.name; | |
| 1296 if (item.supervised) { | |
| 1297 title = l10n_util::GetStringFUTF16(IDS_SUPERVISED_USER_NEW_AVATAR_LABEL, | |
|
msw
2015/03/18 17:15:03
nit q: should this be truncated, like in GetAvatar
Marc Treib
2015/03/18 18:12:02
No, I don't think we explicitly need to truncate h
| |
| 1298 title); | |
| 1299 } | |
| 1300 | |
| 1295 gfx::Image image = profiles::GetSizedAvatarIcon( | 1301 gfx::Image image = profiles::GetSizedAvatarIcon( |
| 1296 item_icon, true, kSmallImageSide, kSmallImageSide); | 1302 item_icon, true, kSmallImageSide, kSmallImageSide); |
| 1297 | 1303 |
| 1298 views::LabelButton* button = new BackgroundColorHoverButton( | 1304 views::LabelButton* button = new BackgroundColorHoverButton( |
| 1299 this, | 1305 this, |
| 1300 item.name, | 1306 title, |
| 1301 *image.ToImageSkia()); | 1307 *image.ToImageSkia()); |
| 1302 open_other_profile_indexes_map_[button] = index; | 1308 open_other_profile_indexes_map_[button] = index; |
| 1303 | 1309 |
| 1304 layout->StartRow(1, 0); | 1310 layout->StartRow(1, 0); |
| 1305 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); | 1311 layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
| 1306 layout->StartRow(1, 0); | 1312 layout->StartRow(1, 0); |
| 1307 layout->AddView(button); | 1313 layout->AddView(button); |
| 1308 } | 1314 } |
| 1309 | 1315 |
| 1310 return view; | 1316 return view; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1713 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1719 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1714 IncognitoModePrefs::DISABLED; | 1720 IncognitoModePrefs::DISABLED; |
| 1715 return incognito_available && !browser_->profile()->IsGuestSession(); | 1721 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1716 } | 1722 } |
| 1717 | 1723 |
| 1718 void ProfileChooserView::PostActionPerformed( | 1724 void ProfileChooserView::PostActionPerformed( |
| 1719 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1725 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1720 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1726 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1721 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1727 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1722 } | 1728 } |
| OLD | NEW |