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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_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/manage_passwords_bubble_view.cc
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 35a937686d01b8869a1014aec4cc6d9aa22340c9..12be51718a31e56eb5a378da44348876d8e69144 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/ui/passwords/password_dialog_prompts.h"
#include "chrome/browser/ui/passwords/passwords_model_delegate.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
+#include "chrome/browser/ui/views/harmony/chrome_typography.h"
#include "chrome/browser/ui/views/passwords/credentials_item_view.h"
#include "chrome/browser/ui/views/passwords/credentials_selection_view.h"
#include "chrome/browser/ui/views/passwords/manage_password_items_view.h"
@@ -39,7 +40,6 @@
#include "ui/views/controls/styled_label_listener.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h"
-#include "ui/views/layout/layout_constants.h"
#include "ui/views/widget/widget.h"
#if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER)
@@ -89,6 +89,8 @@ enum TextRowType { ROW_SINGLE, ROW_MULTILINE };
void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) {
views::ColumnSet* column_set = layout->AddColumnSet(type);
int full_width = ManagePasswordsBubbleView::kDesiredBubbleWidth;
+ const int button_divider = ChromeLayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_RELATED_BUTTON_HORIZONTAL);
switch (type) {
case SINGLE_VIEW_COLUMN_SET:
column_set->AddColumn(views::GridLayout::FILL,
@@ -105,7 +107,7 @@ void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) {
views::GridLayout::USE_PREF,
0,
0);
- column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ column_set->AddPaddingColumn(0, button_divider);
column_set->AddColumn(views::GridLayout::TRAILING,
views::GridLayout::CENTER,
0,
@@ -120,7 +122,7 @@ void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) {
views::GridLayout::USE_PREF,
0,
0);
- column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ column_set->AddPaddingColumn(0, button_divider);
column_set->AddColumn(views::GridLayout::TRAILING,
views::GridLayout::CENTER,
0,
@@ -143,14 +145,14 @@ void BuildColumnSet(views::GridLayout* layout, ColumnSetType type) {
views::GridLayout::USE_PREF,
0,
0);
- column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ column_set->AddPaddingColumn(0, button_divider);
column_set->AddColumn(views::GridLayout::TRAILING,
views::GridLayout::CENTER,
0,
views::GridLayout::USE_PREF,
0,
0);
- column_set->AddPaddingColumn(0, views::kRelatedButtonHSpacing);
+ column_set->AddPaddingColumn(0, button_divider);
column_set->AddColumn(views::GridLayout::TRAILING,
views::GridLayout::CENTER,
0,
@@ -179,13 +181,14 @@ void AddTitleRowWithLink(views::GridLayout* layout,
views::StyledLabel* title_label =
new views::StyledLabel(model->title(), listener);
- title_label->SetBaseFontList(
- ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::MediumFont));
+ title_label->SetBaseFontList(views::style::GetFont(
+ views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY));
title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle());
layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
layout->AddView(title_label);
- layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
+ layout->AddPaddingRow(
+ 0,
+ ChromeLayoutProvider::Get()->GetInsetsMetric(views::INSETS_PANEL).top());
}
} // namespace
@@ -338,7 +341,9 @@ ManagePasswordsBubbleView::PendingView::PendingView(
if (item) {
layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
layout->AddView(item);
- layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
+ layout->AddPaddingRow(0, ChromeLayoutProvider::Get()
+ ->GetInsetsMetric(views::INSETS_PANEL)
+ .bottom());
}
// Button row.
@@ -412,28 +417,22 @@ ManagePasswordsBubbleView::ManageView::ManageView(
views::GridLayout* layout = new views::GridLayout(this);
layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0));
SetLayoutManager(layout);
+ BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
+ layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
// If we have a list of passwords to store for the current site, display
// them to the user for management. Otherwise, render a "No passwords for
// this site" message.
- BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
if (!parent_->model()->local_credentials().empty()) {
ManagePasswordItemsView* item = new ManagePasswordItemsView(
parent_->model(), &parent_->model()->local_credentials());
- layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0,
- views::kUnrelatedControlVerticalSpacing);
layout->AddView(item);
} else {
views::Label* empty_label = new views::Label(
- l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS));
+ l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS),
+ CONTEXT_DEPRECATED_SMALL);
empty_label->SetMultiLine(true);
empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- empty_label->SetFontList(
- ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
-
- layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0,
- views::kUnrelatedControlVerticalSpacing);
layout->AddView(empty_label);
}
@@ -446,9 +445,13 @@ ManagePasswordsBubbleView::ManageView::ManageView(
done_button_ = views::MdTextButton::CreateSecondaryUiButton(
this, l10n_util::GetStringUTF16(IDS_DONE));
+ ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
+ layout->AddPaddingRow(
+ 0, layout_provider->GetInsetsMetric(views::INSETS_PANEL).bottom());
BuildColumnSet(layout, LINK_BUTTON_COLUMN_SET);
- layout->StartRowWithPadding(0, LINK_BUTTON_COLUMN_SET, 0,
- views::kUnrelatedControlVerticalSpacing);
+ layout->StartRowWithPadding(
+ 0, LINK_BUTTON_COLUMN_SET, 0,
+ layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON).top());
layout->AddView(manage_link_);
layout->AddView(done_button_);
@@ -509,11 +512,10 @@ ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView(
views::StyledLabel* confirmation =
new views::StyledLabel(parent_->model()->save_confirmation_text(), this);
- confirmation->SetBaseFontList(
- ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
- confirmation->AddStyleRange(
- parent_->model()->save_confirmation_link_range(), GetLinkStyle());
+ confirmation->SetBaseFontList(views::style::GetFont(
+ CONTEXT_DEPRECATED_SMALL, views::style::STYLE_PRIMARY));
+ confirmation->AddStyleRange(parent_->model()->save_confirmation_link_range(),
+ GetLinkStyle());
BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET);
layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
@@ -522,9 +524,14 @@ ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView(
ok_button_ = views::MdTextButton::CreateSecondaryUiButton(
this, l10n_util::GetStringUTF16(IDS_OK));
+ ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
+ layout->AddPaddingRow(
+ 0, layout_provider->GetInsetsMetric(views::INSETS_PANEL).bottom());
BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET);
- layout->StartRowWithPadding(
- 0, SINGLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing);
+ gfx::Insets button_insets =
+ layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON);
+ layout->StartRowWithPadding(0, SINGLE_BUTTON_COLUMN_SET, 0,
+ button_insets.top());
layout->AddView(ok_button_);
parent_->set_initially_focused_view(ok_button_);
@@ -644,6 +651,7 @@ class ManagePasswordsBubbleView::UpdatePendingView
ManagePasswordsBubbleView::UpdatePendingView::UpdatePendingView(
ManagePasswordsBubbleView* parent)
: parent_(parent), selection_view_(nullptr) {
+ ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
views::GridLayout* layout = new views::GridLayout(this);
layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0));
SetLayoutManager(layout);
@@ -670,11 +678,14 @@ ManagePasswordsBubbleView::UpdatePendingView::UpdatePendingView(
// Credential row.
layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
layout->AddView(item);
+ layout->AddPaddingRow(
+ 0, layout_provider->GetInsetsMetric(views::INSETS_PANEL).bottom());
// Button row.
BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
- layout->StartRowWithPadding(0, DOUBLE_BUTTON_COLUMN_SET, 0,
- views::kUnrelatedControlVerticalSpacing);
+ layout->StartRowWithPadding(
+ 0, DOUBLE_BUTTON_COLUMN_SET, 0,
+ layout_provider->GetInsetsMetric(views::INSETS_DIALOG_BUTTON).top());
layout->AddView(update_button_);
layout->AddView(nope_button_);

Powered by Google App Engine
This is Rietveld 408576698