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

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

Issue 2230963004: [MD User Menu] Un-hardcode profile card's spacing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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/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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 1689
1690 // Profile name, left-aligned to the right of profile icon. 1690 // Profile name, left-aligned to the right of profile icon.
1691 views::Label* current_profile_name = new views::Label( 1691 views::Label* current_profile_name = new views::Label(
1692 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath())); 1692 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath()));
1693 current_profile_name->SetFontList( 1693 current_profile_name->SetFontList(
1694 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( 1694 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
1695 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM)); 1695 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM));
1696 current_profile_name->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1696 current_profile_name->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1697 NonInteractiveContainer* profile_name_container = 1697 NonInteractiveContainer* profile_name_container =
1698 new NonInteractiveContainer(); 1698 new NonInteractiveContainer();
1699 int name_container_v_spacing = views::kRelatedControlVerticalSpacing; 1699 int name_container_v_spacing =
1700 if (!avatar_item.signed_in || switches::IsEnableAccountConsistency()) 1700 std::floor((current_profile_photo->GetPreferredSize().height() -
sky 2016/08/24 19:40:54 Do you really need the floor here? Don't you get w
Jane 2016/08/24 19:54:34 It's for just in case that the divided value has a
sky 2016/08/24 20:29:12 You're setting this to an int, so it's going to be
Jane 2016/08/24 20:35:17 Oh oops, sorry totally forgot!
1701 name_container_v_spacing += views::kRelatedControlVerticalSpacing; 1701 current_profile_name->GetPreferredSize().height()) /
1702 profile_name_container->SetLayoutManager(new views::BoxLayout( 1702 2);
1703 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0)); 1703 views::BoxLayout* profile_name_layout = new views::BoxLayout(
1704 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0);
1705 profile_name_container->SetLayoutManager(profile_name_layout);
1704 profile_name_container->AddChildView(current_profile_name); 1706 profile_name_container->AddChildView(current_profile_name);
1705 1707
1706 const int between_child_spacing = 1708 const int between_child_spacing =
1707 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing(); 1709 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing();
1708 current_profile_card_->SetLayoutManager(new views::BoxLayout( 1710 current_profile_card_->SetLayoutManager(new views::BoxLayout(
1709 views::BoxLayout::kHorizontal, 0, 1711 views::BoxLayout::kHorizontal, 0,
1710 views::kRelatedControlSmallVerticalSpacing, between_child_spacing)); 1712 views::kRelatedControlSmallVerticalSpacing, between_child_spacing));
1711 current_profile_card_->AddChildView(current_profile_photo); 1713 current_profile_card_->AddChildView(current_profile_photo);
1712 current_profile_card_->AddChildView(profile_name_container); 1714 current_profile_card_->AddChildView(profile_name_container);
1713 current_profile_card_->SetMinSize(gfx::Size( 1715 current_profile_card_->SetMinSize(gfx::Size(
(...skipping 17 matching lines...) Expand all
1731 new BackgroundColorHoverButton(this, button_text); 1733 new BackgroundColorHoverButton(this, button_text);
1732 manage_accounts_button_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1734 manage_accounts_button_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1733 manage_accounts_button_->SetMinSize( 1735 manage_accounts_button_->SetMinSize(
1734 gfx::Size(GetFixedMenuWidth(), kButtonHeight)); 1736 gfx::Size(GetFixedMenuWidth(), kButtonHeight));
1735 view->AddChildView(manage_accounts_button_); 1737 view->AddChildView(manage_accounts_button_);
1736 } else { 1738 } else {
1737 views::Label* email_label = new views::Label(avatar_item.username); 1739 views::Label* email_label = new views::Label(avatar_item.username);
1738 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); 1740 email_label->SetElideBehavior(gfx::ELIDE_EMAIL);
1739 email_label->SetEnabled(false); 1741 email_label->SetEnabled(false);
1740 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1742 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1743 name_container_v_spacing =
1744 std::floor((current_profile_photo->GetPreferredSize().height() -
sky 2016/08/24 19:40:54 Same comment here.
Jane 2016/08/24 20:35:17 Done.
1745 current_profile_name->GetPreferredSize().height() -
1746 email_label->GetPreferredSize().height()) /
1747 2);
1748 profile_name_layout->set_inside_border_insets(
1749 gfx::Insets(name_container_v_spacing, 0));
1741 profile_name_container->AddChildView(email_label); 1750 profile_name_container->AddChildView(email_label);
1742 } 1751 }
1743 return view; 1752 return view;
1744 } 1753 }
1745 1754
1746 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile( 1755 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(
1747 browser_->profile()->GetOriginalProfile()); 1756 browser_->profile()->GetOriginalProfile());
1748 if (signin_manager->IsSigninAllowed()) { 1757 if (signin_manager->IsSigninAllowed()) {
1749 views::View* extra_links_view = new views::View(); 1758 views::View* extra_links_view = new views::View();
1750 views::BoxLayout* extra_links_layout = new views::BoxLayout( 1759 views::BoxLayout* extra_links_layout = new views::BoxLayout(
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2303 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2295 IncognitoModePrefs::DISABLED; 2304 IncognitoModePrefs::DISABLED;
2296 return incognito_available && !browser_->profile()->IsGuestSession(); 2305 return incognito_available && !browser_->profile()->IsGuestSession();
2297 } 2306 }
2298 2307
2299 void ProfileChooserView::PostActionPerformed( 2308 void ProfileChooserView::PostActionPerformed(
2300 ProfileMetrics::ProfileDesktopMenu action_performed) { 2309 ProfileMetrics::ProfileDesktopMenu action_performed) {
2301 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 2310 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
2302 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 2311 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
2303 } 2312 }
OLDNEW
« 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