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

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

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reinstate ash browser test fix Created 4 years, 7 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
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/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 views::View* view = new views::View(); 1468 views::View* view = new views::View();
1469 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth); 1469 views::GridLayout* layout = CreateSingleColumnLayout(view, kFixedMenuWidth);
1470 1470
1471 for (size_t index : avatars_to_show) { 1471 for (size_t index : avatars_to_show) {
1472 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index); 1472 const AvatarMenu::Item& item = avatar_menu_->GetItemAt(index);
1473 const int kSmallImageSide = 32; 1473 const int kSmallImageSide = 32;
1474 1474
1475 // Use the low-res, small default avatars in the fast user switcher, like 1475 // Use the low-res, small default avatars in the fast user switcher, like
1476 // we do in the menu bar. 1476 // we do in the menu bar.
1477 gfx::Image item_icon; 1477 gfx::Image item_icon;
1478 bool is_rectangle; 1478 AvatarMenu::GetImageForMenuButton(item.profile_path, &item_icon);
1479 AvatarMenu::GetImageForMenuButton(
1480 item.profile_path, &item_icon, &is_rectangle);
1481 1479
1482 gfx::Image image = profiles::GetSizedAvatarIcon( 1480 gfx::Image image = profiles::GetSizedAvatarIcon(
1483 item_icon, true, kSmallImageSide, kSmallImageSide); 1481 item_icon, true, kSmallImageSide, kSmallImageSide);
1484 1482
1485 views::LabelButton* button = new BackgroundColorHoverButton( 1483 views::LabelButton* button = new BackgroundColorHoverButton(
1486 this, 1484 this,
1487 profiles::GetProfileSwitcherTextForItem(item), 1485 profiles::GetProfileSwitcherTextForItem(item),
1488 *image.ToImageSkia()); 1486 *image.ToImageSkia());
1489 open_other_profile_indexes_map_[button] = index; 1487 open_other_profile_indexes_map_[button] = index;
1490 1488
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1886 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1889 IncognitoModePrefs::DISABLED; 1887 IncognitoModePrefs::DISABLED;
1890 return incognito_available && !browser_->profile()->IsGuestSession(); 1888 return incognito_available && !browser_->profile()->IsGuestSession();
1891 } 1889 }
1892 1890
1893 void ProfileChooserView::PostActionPerformed( 1891 void ProfileChooserView::PostActionPerformed(
1894 ProfileMetrics::ProfileDesktopMenu action_performed) { 1892 ProfileMetrics::ProfileDesktopMenu action_performed) {
1895 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1893 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1896 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1894 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1897 } 1895 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698