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

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: Removed floor and rebased 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 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 1699
1700 // Profile name, left-aligned to the right of profile icon. 1700 // Profile name, left-aligned to the right of profile icon.
1701 views::Label* current_profile_name = new views::Label( 1701 views::Label* current_profile_name = new views::Label(
1702 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath())); 1702 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath()));
1703 current_profile_name->SetFontList( 1703 current_profile_name->SetFontList(
1704 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( 1704 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta(
1705 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM)); 1705 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM));
1706 current_profile_name->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1706 current_profile_name->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1707 NonInteractiveContainer* profile_name_container = 1707 NonInteractiveContainer* profile_name_container =
1708 new NonInteractiveContainer(); 1708 new NonInteractiveContainer();
1709 int name_container_v_spacing = views::kRelatedControlVerticalSpacing; 1709 int name_container_v_spacing =
1710 if (!avatar_item.signed_in || switches::IsEnableAccountConsistency()) 1710 (current_profile_photo->GetPreferredSize().height() -
1711 name_container_v_spacing += views::kRelatedControlVerticalSpacing; 1711 current_profile_name->GetPreferredSize().height()) / 2;
1712 profile_name_container->SetLayoutManager(new views::BoxLayout( 1712 views::BoxLayout* profile_name_layout = new views::BoxLayout(
1713 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0)); 1713 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0);
1714 profile_name_container->SetLayoutManager(profile_name_layout);
1714 profile_name_container->AddChildView(current_profile_name); 1715 profile_name_container->AddChildView(current_profile_name);
1715 1716
1716 const int between_child_spacing = 1717 const int between_child_spacing =
1717 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing(); 1718 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing();
1718 current_profile_card_->SetLayoutManager(new views::BoxLayout( 1719 current_profile_card_->SetLayoutManager(new views::BoxLayout(
1719 views::BoxLayout::kHorizontal, 0, 1720 views::BoxLayout::kHorizontal, 0,
1720 views::kRelatedControlSmallVerticalSpacing, between_child_spacing)); 1721 views::kRelatedControlSmallVerticalSpacing, between_child_spacing));
1721 current_profile_card_->AddChildView(current_profile_photo); 1722 current_profile_card_->AddChildView(current_profile_photo);
1722 current_profile_card_->AddChildView(profile_name_container); 1723 current_profile_card_->AddChildView(profile_name_container);
1723 current_profile_card_->SetMinSize(gfx::Size( 1724 current_profile_card_->SetMinSize(gfx::Size(
(...skipping 17 matching lines...) Expand all
1741 new BackgroundColorHoverButton(this, button_text); 1742 new BackgroundColorHoverButton(this, button_text);
1742 manage_accounts_button_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1743 manage_accounts_button_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1743 manage_accounts_button_->SetMinSize( 1744 manage_accounts_button_->SetMinSize(
1744 gfx::Size(GetFixedMenuWidth(), kButtonHeight)); 1745 gfx::Size(GetFixedMenuWidth(), kButtonHeight));
1745 view->AddChildView(manage_accounts_button_); 1746 view->AddChildView(manage_accounts_button_);
1746 } else { 1747 } else {
1747 views::Label* email_label = new views::Label(avatar_item.username); 1748 views::Label* email_label = new views::Label(avatar_item.username);
1748 email_label->SetElideBehavior(gfx::ELIDE_EMAIL); 1749 email_label->SetElideBehavior(gfx::ELIDE_EMAIL);
1749 email_label->SetEnabled(false); 1750 email_label->SetEnabled(false);
1750 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1751 email_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1752 name_container_v_spacing =
1753 (current_profile_photo->GetPreferredSize().height() -
1754 current_profile_name->GetPreferredSize().height() -
1755 email_label->GetPreferredSize().height()) / 2;
1756 profile_name_layout->set_inside_border_insets(
1757 gfx::Insets(name_container_v_spacing, 0));
1751 profile_name_container->AddChildView(email_label); 1758 profile_name_container->AddChildView(email_label);
1752 } 1759 }
1753 return view; 1760 return view;
1754 } 1761 }
1755 1762
1756 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile( 1763 SigninManagerBase* signin_manager = SigninManagerFactory::GetForProfile(
1757 browser_->profile()->GetOriginalProfile()); 1764 browser_->profile()->GetOriginalProfile());
1758 if (signin_manager->IsSigninAllowed()) { 1765 if (signin_manager->IsSigninAllowed()) {
1759 views::View* extra_links_view = new views::View(); 1766 views::View* extra_links_view = new views::View();
1760 views::BoxLayout* extra_links_layout = new views::BoxLayout( 1767 views::BoxLayout* extra_links_layout = new views::BoxLayout(
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2311 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2305 IncognitoModePrefs::DISABLED; 2312 IncognitoModePrefs::DISABLED;
2306 return incognito_available && !browser_->profile()->IsGuestSession(); 2313 return incognito_available && !browser_->profile()->IsGuestSession();
2307 } 2314 }
2308 2315
2309 void ProfileChooserView::PostActionPerformed( 2316 void ProfileChooserView::PostActionPerformed(
2310 ProfileMetrics::ProfileDesktopMenu action_performed) { 2317 ProfileMetrics::ProfileDesktopMenu action_performed) {
2311 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 2318 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
2312 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 2319 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
2313 } 2320 }
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