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

Unified Diff: chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc

Issue 2869683003: Views/Harmony: Remove references to layout constants in c/b/u/v/passwords. (Closed)
Patch Set: Review comments. 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 side-by-side diff with in-line comments
Download patch
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..01fa7d9abb83c552ea649bc5f39961ac086ff466 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 {
@@ -40,17 +41,19 @@ enum ColumnSetType {
// Construct a |type| ColumnSet and add it to |layout|.
void BuildColumnSet(ColumnSetType type, views::GridLayout* layout) {
views::ColumnSet* column_set = layout->AddColumnSet(type);
- bool padding = (type == SINGLE_VIEW_COLUMN_SET);
- if (padding)
- column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
+ const int horizontal_padding =
+ type == SINGLE_VIEW_COLUMN_SET
+ ? ChromeLayoutProvider::Get()->GetDistanceMetric(
+ DISTANCE_DIALOG_BUTTON_MARGIN)
+ : 0;
+ column_set->AddPaddingColumn(0, horizontal_padding);
column_set->AddColumn(views::GridLayout::FILL,
views::GridLayout::FILL,
1,
views::GridLayout::USE_PREF,
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);
Peter Kasting 2017/05/15 19:51:41 Maybe this should be doing something like (pseudoc
Patti Lor 2017/05/17 07:55:26 Done.
+ credential_view->SetBorder(
+ views::CreateEmptyBorder(kVerticalAvatarMargin, horizontal_padding,
Peter Kasting 2017/05/15 19:51:41 Seems like kVerticalAvatarMargin should maybe be D
Patti Lor 2017/05/17 07:55:26 Done.
+ kVerticalAvatarMargin, horizontal_padding));
item_height = std::max(item_height, credential_view->GetPreferredHeight());
list_view->AddChildView(credential_view);
}
@@ -198,26 +204,29 @@ 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);
+
+ // Show the title.
+ ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
+ layout->StartRowWithPadding(
+ 0, SINGLE_VIEW_COLUMN_SET, 0,
+ layout_provider->GetInsetsMetric(views::INSETS_BUBBLE_TITLE).top());
Peter Kasting 2017/05/15 19:51:41 I think this should have been INSETS_DIALOG_TITLE,
Patti Lor 2017/05/17 07:55:26 Oops - I think I got all mixed up from some of the
layout->AddView(title_label);
- layout->AddPaddingRow(0, 2*views::kRelatedControlVerticalSpacing);
// Show credentials.
+ gfx::Insets bubble_insets =
+ layout_provider->GetInsetsMetric(views::INSETS_BUBBLE_CONTENTS);
BuildColumnSet(SINGLE_VIEW_COLUMN_SET_NO_PADDING, layout);
- layout->StartRow(0, SINGLE_VIEW_COLUMN_SET_NO_PADDING);
+ layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET_NO_PADDING, 0,
+ bubble_insets.top());
layout->AddView(CreateCredentialsView(
controller_->GetLocalForms(),
this,
GetProfileFromWebContents(web_contents_)->GetRequestContext()));
- // DialogClientView adds kRelatedControlVerticalSpacing padding once more for
- // the buttons.
- layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ layout->AddPaddingRow(0, bubble_insets.bottom());
}
AccountChooserPrompt* CreateAccountChooserPromptView(

Powered by Google App Engine
This is Rietveld 408576698