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

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 2159233002: User menu button icon tweaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index 55004998fff8cab168ef10f41037d458d50be60c..37b0ad188523ca5302e2cd1d06c0ef4ce2cb797b 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -184,7 +184,9 @@ class BackgroundColorHoverButton : public views::LabelButton {
BackgroundColorHoverButton(views::ButtonListener* listener,
const base::string16& text)
: views::LabelButton(listener, text) {
- SetImageLabelSpacing(views::kItemLabelSpacing);
+ SetImageLabelSpacing(switches::IsMaterialDesignUserMenu()
+ ? (kMaterialMenuEdgeMargin - 2)
+ : views::kItemLabelSpacing);
const int button_margin = switches::IsMaterialDesignUserMenu()
? kMaterialMenuEdgeMargin
: views::kButtonHEdgeMarginNew;
@@ -1699,6 +1701,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
views::GridLayout* layout =
CreateSingleColumnLayout(view, GetFixedMenuWidth());
+ const bool is_guest = browser_->profile()->IsGuestSession();
const int kIconSize = switches::IsMaterialDesignUserMenu() ? 20 : 16;
if (switches::IsMaterialDesignUserMenu()) {
// Add the user switching buttons
@@ -1713,6 +1716,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
views::LabelButton* button = new BackgroundColorHoverButton(
this, profiles::GetProfileSwitcherTextForItem(item),
*image.ToImageSkia());
+ button->SetImageLabelSpacing(kMaterialMenuEdgeMargin);
open_other_profile_indexes_map_[button] = i;
layout->StartRow(1, 0);
@@ -1721,7 +1725,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
}
// Add the "Guest" button for browsing as guest
- if (!browser_->profile()->IsGuestSession()) {
+ if (!is_guest) {
PrefService* service = g_browser_process->local_state();
DCHECK(service);
if (service->GetBoolean(prefs::kBrowserGuestModeEnabled)) {
@@ -1735,14 +1739,19 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
}
}
- base::string16 text = browser_->profile()->IsGuestSession() ?
- l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST) :
- l10n_util::GetStringUTF16(IDS_PROFILES_SWITCH_USERS_BUTTON);
- gfx::VectorIconId settings_icon = gfx::VectorIconId::ACCOUNT_BOX;
- if (!browser_->profile()->IsGuestSession()
- && switches::IsMaterialDesignUserMenu()) {
- text = l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON);
- settings_icon = gfx::VectorIconId::SETTINGS;
+ base::string16 text;
+ gfx::VectorIconId settings_icon;
+ if (switches::IsMaterialDesignUserMenu()) {
+ text = is_guest
+ ? l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST)
+ : l10n_util::GetStringUTF16(IDS_PROFILES_MANAGE_USERS_BUTTON);
+ settings_icon =
+ is_guest ? gfx::VectorIconId::CLOSE_ALL : gfx::VectorIconId::SETTINGS;
+ } else {
+ text = is_guest
+ ? l10n_util::GetStringUTF16(IDS_PROFILES_EXIT_GUEST)
+ : l10n_util::GetStringUTF16(IDS_PROFILES_SWITCH_USERS_BUTTON);
+ settings_icon = gfx::VectorIconId::ACCOUNT_BOX;
}
users_button_ = new BackgroundColorHoverButton(
this, text, gfx::CreateVectorIcon(settings_icon, kIconSize,
@@ -1776,8 +1785,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool display_lock,
gfx::kChromeIconGrey));
layout->StartRow(1, 0);
layout->AddView(lock_button_);
- } else if (switches::IsMaterialDesignUserMenu() &&
- !browser_->profile()->IsGuestSession()) {
+ } else if (switches::IsMaterialDesignUserMenu() && !is_guest) {
int num_browsers = 0;
for (auto* browser : *BrowserList::GetInstance()) {
if (browser->profile()->GetOriginalProfile() ==
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698