Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 1028603003: Fast user switcher: Distinguish supervised users from child accounts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 guest_avatar_item.signed_in = false; 1272 guest_avatar_item.signed_in = false;
1273 1273
1274 return CreateCurrentProfileView(guest_avatar_item, true); 1274 return CreateCurrentProfileView(guest_avatar_item, true);
1275 } 1275 }
1276 1276
1277 views::View* ProfileChooserView::CreateOtherProfilesView( 1277 views::View* ProfileChooserView::CreateOtherProfilesView(
1278 const Indexes& avatars_to_show) { 1278 const Indexes& avatars_to_show) {
1279 views::View* view = new views::View(); 1279 views::View* view = new views::View();
1280 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1280 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth);
1281 1281
1282 int num_avatars_to_show = avatars_to_show.size(); 1282 for (size_t index : avatars_to_show) {
1283 for (int i = 0; i < num_avatars_to_show; ++i) {
1284 const size_t index = avatars_to_show[i];
1285 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); 1283 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index);
1286 const int kSmallImageSide = 32; 1284 const int kSmallImageSide = 32;
1287 1285
1288 // Use the low-res, small default avatars in the fast user switcher, like 1286 // Use the low-res, small default avatars in the fast user switcher, like
1289 // we do in the menu bar. 1287 // we do in the menu bar.
1290 gfx::Image item_icon; 1288 gfx::Image item_icon;
1291 bool is_rectangle; 1289 bool is_rectangle;
1292 AvatarMenu::GetImageForMenuButton( 1290 AvatarMenu::GetImageForMenuButton(
1293 item.profile_path, &item_icon, &is_rectangle); 1291 item.profile_path, &item_icon, &is_rectangle);
1294 1292
1295 base::string16 title = item.name; 1293 base::string16 title = item.name;
1296 if (item.supervised) { 1294 if (item.legacy_supervised) {
1297 title = l10n_util::GetStringFUTF16(IDS_SUPERVISED_USER_NEW_AVATAR_LABEL, 1295 title = l10n_util::GetStringFUTF16(IDS_SUPERVISED_USER_NEW_AVATAR_LABEL,
1298 title); 1296 title);
1297 } else if (item.child_account) {
1298 title = l10n_util::GetStringFUTF16(IDS_CHILD_AVATAR_LABEL, title);
1299 } 1299 }
1300 1300
1301 gfx::Image image = profiles::GetSizedAvatarIcon( 1301 gfx::Image image = profiles::GetSizedAvatarIcon(
1302 item_icon, true, kSmallImageSide, kSmallImageSide); 1302 item_icon, true, kSmallImageSide, kSmallImageSide);
1303 1303
1304 views::LabelButton* button = new BackgroundColorHoverButton( 1304 views::LabelButton* button = new BackgroundColorHoverButton(
1305 this, 1305 this,
1306 title, 1306 title,
1307 *image.ToImageSkia()); 1307 *image.ToImageSkia());
1308 open_other_profile_indexes_map_[button] = index; 1308 open_other_profile_indexes_map_[button] = index;
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1719 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1720 IncognitoModePrefs::DISABLED; 1720 IncognitoModePrefs::DISABLED;
1721 return incognito_available && !browser_->profile()->IsGuestSession(); 1721 return incognito_available && !browser_->profile()->IsGuestSession();
1722 } 1722 }
1723 1723
1724 void ProfileChooserView::PostActionPerformed( 1724 void ProfileChooserView::PostActionPerformed(
1725 ProfileMetrics::ProfileDesktopMenu action_performed) { 1725 ProfileMetrics::ProfileDesktopMenu action_performed) {
1726 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1726 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1727 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1727 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1728 } 1728 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698