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

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

Issue 2859193004: Remove GridLayout::SetInsets in favor of an empty border on the host. (Closed)
Patch Set: fix compile and tests Created 3 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/app/vector_icons/vector_icons.h" 10 #include "chrome/app/vector_icons/vector_icons.h"
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 const base::string16& button_text, 1100 const base::string16& button_text,
1101 bool stack_button, 1101 bool stack_button,
1102 views::Link** link, 1102 views::Link** link,
1103 views::LabelButton** button, 1103 views::LabelButton** button,
1104 views::ImageButton** close_button) { 1104 views::ImageButton** close_button) {
1105 tutorial_mode_ = tutorial_mode; 1105 tutorial_mode_ = tutorial_mode;
1106 1106
1107 views::View* view = new views::View(); 1107 views::View* view = new views::View();
1108 view->set_background(views::Background::CreateSolidBackground( 1108 view->set_background(views::Background::CreateSolidBackground(
1109 profiles::kAvatarTutorialBackgroundColor)); 1109 profiles::kAvatarTutorialBackgroundColor));
1110 view->SetBorder(views::CreateEmptyBorder(
1111 views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew,
1112 views::kButtonVEdgeMarginNew, views::kButtonHEdgeMarginNew));
1110 views::GridLayout* layout = CreateSingleColumnLayout( 1113 views::GridLayout* layout = CreateSingleColumnLayout(
1111 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew); 1114 view, kFixedMenuWidth - 2 * views::kButtonHEdgeMarginNew);
1112 // Creates a second column set for buttons and links. 1115 // Creates a second column set for buttons and links.
1113 views::ColumnSet* button_columns = layout->AddColumnSet(1); 1116 views::ColumnSet* button_columns = layout->AddColumnSet(1);
1114 button_columns->AddColumn(views::GridLayout::LEADING, 1117 button_columns->AddColumn(views::GridLayout::LEADING,
1115 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 1118 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
1116 button_columns->AddPaddingColumn( 1119 button_columns->AddPaddingColumn(
1117 1, views::kUnrelatedControlHorizontalSpacing); 1120 1, views::kUnrelatedControlHorizontalSpacing);
1118 button_columns->AddColumn(views::GridLayout::TRAILING, 1121 button_columns->AddColumn(views::GridLayout::TRAILING,
1119 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); 1122 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0);
1120 layout->SetInsets(views::kButtonVEdgeMarginNew,
1121 views::kButtonHEdgeMarginNew,
1122 views::kButtonVEdgeMarginNew,
1123 views::kButtonHEdgeMarginNew);
1124 1123
1125 // Adds title and close button if needed. 1124 // Adds title and close button if needed.
1126 const SkColor kTitleAndButtonTextColor = SK_ColorWHITE; 1125 const SkColor kTitleAndButtonTextColor = SK_ColorWHITE;
1127 views::Label* title_label = new views::Label(title_text); 1126 views::Label* title_label = new views::Label(title_text);
1128 title_label->SetMultiLine(true); 1127 title_label->SetMultiLine(true);
1129 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1128 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1130 title_label->SetAutoColorReadabilityEnabled(false); 1129 title_label->SetAutoColorReadabilityEnabled(false);
1131 title_label->SetEnabledColor(kTitleAndButtonTextColor); 1130 title_label->SetEnabledColor(kTitleAndButtonTextColor);
1132 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( 1131 title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
1133 ui::ResourceBundle::MediumFont)); 1132 ui::ResourceBundle::MediumFont));
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 1557
1559 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing); 1558 layout->StartRowWithPadding(1, 0, 0, views::kRelatedControlVerticalSpacing);
1560 return view; 1559 return view;
1561 } 1560 }
1562 1561
1563 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() { 1562 views::View* ProfileChooserView::CreateSupervisedUserDisclaimerView() {
1564 views::View* view = new views::View(); 1563 views::View* view = new views::View();
1565 int horizontal_margin = kMenuEdgeMargin; 1564 int horizontal_margin = kMenuEdgeMargin;
1566 views::GridLayout* layout = 1565 views::GridLayout* layout =
1567 CreateSingleColumnLayout(view, kFixedMenuWidth - 2 * horizontal_margin); 1566 CreateSingleColumnLayout(view, kFixedMenuWidth - 2 * horizontal_margin);
1568 layout->SetInsets(0, horizontal_margin, kMenuEdgeMargin, horizontal_margin); 1567 view->SetBorder(views::CreateEmptyBorder(0, horizontal_margin,
1568 kMenuEdgeMargin, horizontal_margin));
1569 1569
1570 views::Label* disclaimer = new views::Label( 1570 views::Label* disclaimer = new views::Label(
1571 avatar_menu_->GetSupervisedUserInformation()); 1571 avatar_menu_->GetSupervisedUserInformation());
1572 disclaimer->SetMultiLine(true); 1572 disclaimer->SetMultiLine(true);
1573 disclaimer->SetAllowCharacterBreak(true); 1573 disclaimer->SetAllowCharacterBreak(true);
1574 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1574 disclaimer->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1575 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1575 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1576 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont)); 1576 disclaimer->SetFontList(rb->GetFontList(ui::ResourceBundle::SmallFont));
1577 layout->StartRow(1, 0); 1577 layout->StartRow(1, 0);
1578 layout->AddView(disclaimer); 1578 layout->AddView(disclaimer);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 this, 1709 this,
1710 &gaia_signin_cancel_button_); 1710 &gaia_signin_cancel_button_);
1711 return TitleCard::AddPaddedTitleCard( 1711 return TitleCard::AddPaddedTitleCard(
1712 web_view.release(), title_card, kPasswordCombinedFixedGaiaViewWidth); 1712 web_view.release(), title_card, kPasswordCombinedFixedGaiaViewWidth);
1713 } 1713 }
1714 1714
1715 views::View* ProfileChooserView::CreateAccountRemovalView() { 1715 views::View* ProfileChooserView::CreateAccountRemovalView() {
1716 views::View* view = new views::View(); 1716 views::View* view = new views::View();
1717 views::GridLayout* layout = CreateSingleColumnLayout( 1717 views::GridLayout* layout = CreateSingleColumnLayout(
1718 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew); 1718 view, kFixedAccountRemovalViewWidth - 2 * views::kButtonHEdgeMarginNew);
1719 layout->SetInsets(0, 1719 view->SetBorder(views::CreateEmptyBorder(0, views::kButtonHEdgeMarginNew,
1720 views::kButtonHEdgeMarginNew, 1720 views::kButtonVEdgeMarginNew,
1721 views::kButtonVEdgeMarginNew, 1721 views::kButtonHEdgeMarginNew));
1722 views::kButtonHEdgeMarginNew);
1723 1722
1724 const std::string& primary_account = SigninManagerFactory::GetForProfile( 1723 const std::string& primary_account = SigninManagerFactory::GetForProfile(
1725 browser_->profile())->GetAuthenticatedAccountId(); 1724 browser_->profile())->GetAuthenticatedAccountId();
1726 bool is_primary_account = primary_account == account_id_to_remove_; 1725 bool is_primary_account = primary_account == account_id_to_remove_;
1727 1726
1728 // Adds main text. 1727 // Adds main text.
1729 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing); 1728 layout->StartRowWithPadding(1, 0, 0, views::kUnrelatedControlVerticalSpacing);
1730 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1729 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1731 const gfx::FontList& small_font_list = 1730 const gfx::FontList& small_font_list =
1732 rb->GetFontList(ui::ResourceBundle::SmallFont); 1731 rb->GetFontList(ui::ResourceBundle::SmallFont);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1892 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1894 IncognitoModePrefs::DISABLED; 1893 IncognitoModePrefs::DISABLED;
1895 return incognito_available && !browser_->profile()->IsGuestSession(); 1894 return incognito_available && !browser_->profile()->IsGuestSession();
1896 } 1895 }
1897 1896
1898 void ProfileChooserView::PostActionPerformed( 1897 void ProfileChooserView::PostActionPerformed(
1899 ProfileMetrics::ProfileDesktopMenu action_performed) { 1898 ProfileMetrics::ProfileDesktopMenu action_performed) {
1900 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1899 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1901 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1900 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1902 } 1901 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698