Chromium Code Reviews| Index: chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc |
| diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc |
| index 19841acd2a009a6ce7ded48f2ca812e85eacf89c..f013389f297d5ae1a75a17ae9abd48054e6a5ba0 100644 |
| --- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc |
| +++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc |
| @@ -8,6 +8,7 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/passwords/manage_passwords_view_utils.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/passwords/credentials_item_view.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/autofill/core/common/password_form.h" |
| @@ -21,7 +22,7 @@ |
| #include "ui/views/controls/styled_label.h" |
| #include "ui/views/layout/box_layout.h" |
| #include "ui/views/layout/grid_layout.h" |
| -#include "ui/views/layout/layout_constants.h" |
| +#include "ui/views/style/typography.h" |
| #include "ui/views/widget/widget.h" |
| namespace { |
| @@ -41,8 +42,10 @@ enum ColumnSetType { |
| void BuildColumnSet(ColumnSetType type, views::GridLayout* layout) { |
| views::ColumnSet* column_set = layout->AddColumnSet(type); |
| bool padding = (type == SINGLE_VIEW_COLUMN_SET); |
|
tapted
2017/05/10 05:30:11
padding -> add_padding?
(or in fact I'd suggest s
Patti Lor
2017/05/11 06:59:18
Done (implemented your second option :) )
|
| + const int horizontal_padding = ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_DIALOG_BUTTON_MARGIN); |
|
tapted
2017/05/10 05:30:11
(I mentioned that DISTANCE_PANEL_CONTENT_MARGIN co
Patti Lor
2017/05/11 06:59:18
Acknowledged.
|
| if (padding) |
| - column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| + column_set->AddPaddingColumn(0, horizontal_padding); |
| column_set->AddColumn(views::GridLayout::FILL, |
| views::GridLayout::FILL, |
| 1, |
| @@ -50,7 +53,7 @@ void BuildColumnSet(ColumnSetType type, views::GridLayout* layout) { |
| 0, |
| 0); |
| if (padding) |
| - column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); |
| + column_set->AddPaddingColumn(0, horizontal_padding); |
| } |
| views::StyledLabel::RangeStyleInfo GetLinkStyle() { |
| @@ -81,9 +84,12 @@ views::ScrollView* CreateCredentialsView( |
| button_listener, titles.first, titles.second, kButtonHoverColor, |
| form.get(), request_context); |
| credential_view->SetLowerLabelColor(kAutoSigninTextColor); |
| - credential_view->SetBorder(views::CreateEmptyBorder( |
| - kVerticalAvatarMargin, views::kButtonHEdgeMarginNew, |
| - kVerticalAvatarMargin, views::kButtonHEdgeMarginNew)); |
| + const int horizontal_padding = |
| + ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_DIALOG_BUTTON_MARGIN); |
| + credential_view->SetBorder( |
| + views::CreateEmptyBorder(kVerticalAvatarMargin, horizontal_padding, |
| + kVerticalAvatarMargin, horizontal_padding)); |
| item_height = std::max(item_height, credential_view->GetPreferredHeight()); |
| list_view->AddChildView(credential_view); |
| } |
| @@ -198,15 +204,18 @@ void AccountChooserDialogView::InitWindow() { |
| controller_->GetAccoutChooserTitle(); |
| views::StyledLabel* title_label = |
| new views::StyledLabel(title_content.first, this); |
| - title_label->SetBaseFontList( |
| - ui::ResourceBundle::GetSharedInstance().GetFontList( |
| - ui::ResourceBundle::MediumFont)); |
| - if (!title_content.second.is_empty()) { |
| + |
| + title_label->SetBaseFontList(views::style::GetFont( |
| + views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY)); |
| + if (!title_content.second.is_empty()) |
| title_label->AddStyleRange(title_content.second, GetLinkStyle()); |
| - } |
| - layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, kTitleTopInset); |
| + ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); |
| + layout->StartRowWithPadding( |
| + 0, SINGLE_VIEW_COLUMN_SET, 0, |
| + layout_provider->GetDistanceMetric(DISTANCE_PANEL_CONTENT_MARGIN)); |
|
tapted
2017/05/10 05:30:11
I don't think DISTANCE_PANEL_CONTENT_MARGIN is rig
Patti Lor
2017/05/11 06:59:18
I think they're the same? I switched to use the in
|
| layout->AddView(title_label); |
| - layout->AddPaddingRow(0, 2*views::kRelatedControlVerticalSpacing); |
| + layout->AddPaddingRow(0, layout_provider->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| // Show credentials. |
| BuildColumnSet(SINGLE_VIEW_COLUMN_SET_NO_PADDING, layout); |
| @@ -215,9 +224,9 @@ void AccountChooserDialogView::InitWindow() { |
| controller_->GetLocalForms(), |
| this, |
| GetProfileFromWebContents(web_contents_)->GetRequestContext())); |
| - // DialogClientView adds kRelatedControlVerticalSpacing padding once more for |
| - // the buttons. |
| - layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| + // DialogClientView adds more vertical padding for space above the buttons. |
|
tapted
2017/05/10 05:30:11
above -> below?
Patti Lor
2017/05/11 06:59:17
No - it's using GetDialogButtons() later on, so th
|
| + layout->AddPaddingRow(0, layout_provider->GetDistanceMetric( |
| + views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
|
tapted
2017/05/10 05:30:11
similar thing here - should it be GetInsetsMetric(
Patti Lor
2017/05/11 06:59:17
Done, + bubble content insets bottom.
|
| } |
| AccountChooserPrompt* CreateAccountChooserPromptView( |