Chromium Code Reviews| Index: chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc |
| diff --git a/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc b/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc |
| index 1b2b28947fa9da219f51071b97a40dc2e0989525..c66e22d4df283c2553df1f2e4b14648d6d66000b 100644 |
| --- a/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc |
| +++ b/chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.cc |
| @@ -5,6 +5,8 @@ |
| #include "chrome/browser/ui/views/passwords/auto_signin_first_run_dialog_view.h" |
| #include "chrome/browser/ui/passwords/password_dialog_controller.h" |
| +#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| +#include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/constrained_window/constrained_window_views.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -12,7 +14,6 @@ |
| #include "ui/views/controls/button/md_text_button.h" |
| #include "ui/views/controls/styled_label.h" |
| #include "ui/views/layout/grid_layout.h" |
| -#include "ui/views/layout/layout_constants.h" |
| #include "ui/views/widget/widget.h" |
| namespace { |
| @@ -31,7 +32,10 @@ enum ColumnSetType { |
| // to |layout|. |
| void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) { |
| views::ColumnSet* column_set = layout->AddColumnSet(type); |
| - column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| + ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); |
| + const int horizontal_padding = |
| + layout_provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN); |
| + column_set->AddPaddingColumn(0, horizontal_padding); |
| switch (type) { |
| case SINGLE_VIEW_COLUMN_SET: |
| column_set->AddColumn(views::GridLayout::FILL, |
| @@ -48,7 +52,9 @@ void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) { |
| views::GridLayout::USE_PREF, |
| 0, |
| 0); |
| - column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing); |
| + column_set->AddPaddingColumn( |
| + 0, layout_provider->GetDistanceMetric( |
| + views::DISTANCE_RELATED_BUTTON_HORIZONTAL)); |
| column_set->AddColumn(views::GridLayout::TRAILING, |
| views::GridLayout::CENTER, |
| 0, |
| @@ -57,7 +63,7 @@ void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) { |
| 0); |
| break; |
| } |
| - column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| + column_set->AddPaddingColumn(0, horizontal_padding); |
| } |
| } // namespace |
| @@ -138,26 +144,23 @@ void AutoSigninFirstRunDialogView::StyledLabelLinkClicked( |
| } |
| void AutoSigninFirstRunDialogView::InitWindow() { |
| + ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); |
| views::GridLayout* layout = new views::GridLayout(this); |
| SetLayoutManager(layout); |
| BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
| // Title. |
| - views::Label* title_label = new views::Label(GetWindowTitle()); |
| + views::Label* title_label = |
| + new views::Label(GetWindowTitle(), views::style::CONTEXT_DIALOG_TITLE); |
| title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| - title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| - ui::ResourceBundle::MediumFont)); |
| - layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, kTitleTopInset); |
| - layout->AddView(title_label); |
| // Content. |
| std::pair<base::string16, gfx::Range> text_content = |
| controller_->GetAutoSigninText(); |
| views::StyledLabel* content_label = |
| new views::StyledLabel(text_content.first, this); |
| - content_label->SetBaseFontList( |
| - ui::ResourceBundle::GetSharedInstance().GetFontList( |
| - ui::ResourceBundle::SmallFont)); |
| + content_label->SetBaseFontList(views::style::GetFont( |
| + CONTEXT_DEPRECATED_SMALL, views::style::STYLE_PRIMARY)); |
| views::StyledLabel::RangeStyleInfo default_style; |
| default_style.color = kAutoSigninTextColor; |
| content_label->SetDefaultStyle(default_style); |
| @@ -166,21 +169,33 @@ void AutoSigninFirstRunDialogView::InitWindow() { |
| text_content.second, |
| views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| } |
| - layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, |
| - 2 * views::kRelatedControlVerticalSpacing); |
| - layout->AddView(content_label); |
| // Buttons. |
| - BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
| - layout->StartRowWithPadding(0, DOUBLE_BUTTON_COLUMN_SET, 0, |
| - 3 * views::kRelatedControlVerticalSpacing); |
| ok_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| this, l10n_util::GetStringUTF16(IDS_AUTO_SIGNIN_FIRST_RUN_OK)); |
| turn_off_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| this, l10n_util::GetStringUTF16(IDS_AUTO_SIGNIN_FIRST_RUN_TURN_OFF)); |
| + |
| + // Layout. |
| + layout->StartRowWithPadding( |
| + 0, SINGLE_VIEW_COLUMN_SET, 0, |
| + layout_provider->GetInsetsMetric(views::INSETS_DIALOG_TITLE).top()); |
| + layout->AddView(title_label); |
| + const gfx::Insets bubble_insets = |
| + layout_provider->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS); |
| + layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, |
| + bubble_insets.top()); |
| + layout->AddView(content_label); |
| + layout->AddPaddingRow(0, bubble_insets.bottom()); |
| + |
| + BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
| + const gfx::Insets button_insets = |
| + layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON); |
| + layout->StartRowWithPadding(0, DOUBLE_BUTTON_COLUMN_SET, 0, |
| + button_insets.top()); |
|
tapted
2017/05/12 03:36:10
nice!
Patti Lor
2017/05/15 01:53:48
Thanks? Haha :)
|
| layout->AddView(ok_button_); |
| layout->AddView(turn_off_button_); |
| - layout->AddPaddingRow(0, views::kButtonVEdgeMarginNew); |
| + layout->AddPaddingRow(0, button_insets.bottom()); |
| } |
| AutoSigninFirstRunPrompt* CreateAutoSigninPromptView( |