Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1558 | 1558 |
| 1559 // Profile name, left-aligned to the right of profile icon. | 1559 // Profile name, left-aligned to the right of profile icon. |
| 1560 views::Label* current_profile_name = new views::Label( | 1560 views::Label* current_profile_name = new views::Label( |
| 1561 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath())); | 1561 profiles::GetAvatarNameForProfile(browser_->profile()->GetPath())); |
| 1562 current_profile_name->SetFontList( | 1562 current_profile_name->SetFontList( |
| 1563 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( | 1563 ui::ResourceBundle::GetSharedInstance().GetFontListWithDelta( |
| 1564 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM)); | 1564 1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::MEDIUM)); |
| 1565 current_profile_name->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1565 current_profile_name->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1566 NonInteractiveContainer* profile_name_container = | 1566 NonInteractiveContainer* profile_name_container = |
| 1567 new NonInteractiveContainer(); | 1567 new NonInteractiveContainer(); |
| 1568 int name_container_v_spacing = views::kRelatedControlSmallVerticalSpacing; | 1568 int name_container_v_spacing = views::kRelatedControlVerticalSpacing; |
| 1569 if (!avatar_item.signed_in || switches::IsEnableAccountConsistency()) | 1569 if (!avatar_item.signed_in || switches::IsEnableAccountConsistency()) |
| 1570 name_container_v_spacing += views::kRelatedControlVerticalSpacing; | 1570 name_container_v_spacing += views::kRelatedControlVerticalSpacing; |
| 1571 profile_name_container->SetLayoutManager(new views::BoxLayout( | 1571 profile_name_container->SetLayoutManager(new views::BoxLayout( |
| 1572 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0)); | 1572 views::BoxLayout::kVertical, 0, name_container_v_spacing, 0)); |
| 1573 profile_name_container->AddChildView(current_profile_name); | 1573 profile_name_container->AddChildView(current_profile_name); |
| 1574 | 1574 |
| 1575 const int between_child_spacing = | 1575 const int between_child_spacing = |
| 1576 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing(); | 1576 kMaterialMenuEdgeMargin - EditableProfilePhoto::badge_spacing(); |
| 1577 current_profile_card_->SetLayoutManager(new views::BoxLayout( | 1577 current_profile_card_->SetLayoutManager(new views::BoxLayout( |
| 1578 views::BoxLayout::kHorizontal, 0, | 1578 views::BoxLayout::kHorizontal, 0, |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1794 } | 1794 } |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 if (switches::IsMaterialDesignUserMenu()) | 1797 if (switches::IsMaterialDesignUserMenu()) |
| 1798 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); | 1798 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); |
| 1799 return view; | 1799 return view; |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { | 1802 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { |
| 1803 views::View* view = new views::View(); | 1803 views::View* view = new views::View(); |
| 1804 int horizontalMargin = switches::IsMaterialDesignUserMenu() ? | |
|
msw
2016/07/12 19:10:00
nit: horizontal_margin (match naming conventions)
Jane
2016/07/12 19:15:11
Thanks! I was on cocoa for too long...
| |
| 1805 kMaterialMenuEdgeMargin : views::kButtonHEdgeMarginNew; | |
| 1804 views::GridLayout* layout = CreateSingleColumnLayout( | 1806 views::GridLayout* layout = CreateSingleColumnLayout( |
| 1805 view, GetFixedMenuWidth() - 2 * views::kButtonHEdgeMarginNew); | 1807 view, GetFixedMenuWidth() - 2 * horizontalMargin); |
| 1806 if (switches::IsMaterialDesignUserMenu()) { | 1808 if (switches::IsMaterialDesignUserMenu()) { |
| 1807 layout->SetInsets(0, kMaterialMenuEdgeMargin, kMaterialMenuEdgeMargin, | 1809 layout->SetInsets(0, horizontalMargin, |
| 1808 kMaterialMenuEdgeMargin); | 1810 kMaterialMenuEdgeMargin, horizontalMargin); |
| 1809 } else { | 1811 } else { |
| 1810 layout->SetInsets( | 1812 layout->SetInsets( |
| 1811 views::kRelatedControlVerticalSpacing, views::kButtonHEdgeMarginNew, | 1813 views::kRelatedControlVerticalSpacing, horizontalMargin, |
| 1812 views::kRelatedControlVerticalSpacing, views::kButtonHEdgeMarginNew); | 1814 views::kRelatedControlVerticalSpacing, horizontalMargin); |
| 1813 } | 1815 } |
| 1814 | 1816 |
| 1815 views::Label* disclaimer = new views::Label( | 1817 views::Label* disclaimer = new views::Label( |
| 1816 avatar_menu_->GetSupervisedUserInformation()); | 1818 avatar_menu_->GetSupervisedUserInformation()); |
| 1817 disclaimer->SetMultiLine(true); | 1819 disclaimer->SetMultiLine(true); |
| 1818 disclaimer->SetAllowCharacterBreak(true); | 1820 disclaimer->SetAllowCharacterBreak(true); |
| 1819 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1821 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1820 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 1822 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 1821 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); | 1823 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); |
| 1822 layout->StartRow(1, 0); | 1824 layout->StartRow(1, 0); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2155 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2157 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2156 IncognitoModePrefs::DISABLED; | 2158 IncognitoModePrefs::DISABLED; |
| 2157 return incognito_available && !browser_->profile()->IsGuestSession(); | 2159 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 2158 } | 2160 } |
| 2159 | 2161 |
| 2160 void ProfileChooserView::PostActionPerformed( | 2162 void ProfileChooserView::PostActionPerformed( |
| 2161 ProfileMetrics::ProfileDesktopMenu action_performed) { | 2163 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 2162 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 2164 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 2163 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 2165 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2164 } | 2166 } |
| OLD | NEW |