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

Unified Diff: chrome/browser/ui/views/passwords/auto_signin_first_run_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/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..b115fa8fd83883c82f1b5ed979ec15373b276ec4 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 {
@@ -22,7 +23,7 @@ enum ColumnSetType {
SINGLE_VIEW_COLUMN_SET,
// | | (TRAILING, CENTER) | | (TRAILING, CENTER) | |
- // Used for buttons at the bottom of the bubble which should nest at the
+ // Used for buttons at the bottom of the dialog which should nest at the
// bottom-right corner.
DOUBLE_BUTTON_COLUMN_SET,
};
@@ -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();
+ gfx::Insets dialog_insets =
+ layout_provider->GetInsetsMetric(views::INSETS_PANEL);
+ column_set->AddPaddingColumn(0, dialog_insets.left());
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, dialog_insets.right());
}
} // 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 dialog_insets =
+ layout_provider->GetInsetsMetric(views::INSETS_PANEL);
+ layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0,
+ dialog_insets.top());
+ layout->AddView(content_label);
+ layout->AddPaddingRow(0, dialog_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());
layout->AddView(ok_button_);
layout->AddView(turn_off_button_);
- layout->AddPaddingRow(0, views::kButtonVEdgeMarginNew);
+ layout->AddPaddingRow(0, button_insets.bottom());
}
AutoSigninFirstRunPrompt* CreateAutoSigninPromptView(

Powered by Google App Engine
This is Rietveld 408576698