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

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

Issue 2869683003: Views/Harmony: Remove references to layout constants in c/b/u/v/passwords. (Closed)
Patch Set: 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_password_items_view.cc
diff --git a/chrome/browser/ui/views/passwords/manage_password_items_view.cc b/chrome/browser/ui/views/passwords/manage_password_items_view.cc
index 8443799ace65850a97f9c961c84770ea61e63eef..27be28ee49cd404b8f4b1f9eb3b776a588aa52ab 100644
--- a/chrome/browser/ui/views/passwords/manage_password_items_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_password_items_view.cc
@@ -11,6 +11,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
+#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -22,7 +23,6 @@
#include "ui/views/controls/link_listener.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h"
-#include "ui/views/layout/layout_constants.h"
namespace {
@@ -44,9 +44,12 @@ void BuildColumnSetIfNeeded(views::GridLayout* layout, int column_set_id) {
views::GridLayout::USE_PREF,
0,
0);
+
+ const int column_divider = ChromeLayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_RELATED_CONTROL_HORIZONTAL);
if (column_set_id >= TWO_COLUMN_SET) {
// The password/"Undo!" field.
- column_set->AddPaddingColumn(0, views::kItemLabelSpacing);
+ column_set->AddPaddingColumn(0, column_divider);
column_set->AddColumn(views::GridLayout::FILL,
views::GridLayout::FILL,
1,
@@ -56,7 +59,7 @@ void BuildColumnSetIfNeeded(views::GridLayout* layout, int column_set_id) {
}
// If we're in manage-mode, we need another column for the delete button.
if (column_set_id == THREE_COLUMN_SET) {
- column_set->AddPaddingColumn(0, views::kItemLabelSpacing);
+ column_set->AddPaddingColumn(0, column_divider);
column_set->AddColumn(views::GridLayout::TRAILING,
views::GridLayout::FILL,
0,
@@ -70,8 +73,8 @@ std::unique_ptr<views::Label> GenerateUsernameLabel(
const autofill::PasswordForm& form) {
std::unique_ptr<views::Label> label(
new views::Label(GetDisplayUsername(form)));
tapted 2017/05/10 05:30:11 CONTEXT_DEPRECATED_SMALL
Patti Lor 2017/05/11 06:59:18 Done.
- label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
+ label->SetFontList(views::style::GetFont(views::style::CONTEXT_LABEL,
+ views::style::STYLE_PRIMARY));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
return label;
}
@@ -85,8 +88,8 @@ std::unique_ptr<views::Label> GeneratePasswordLabel(
IDS_PASSWORDS_VIA_FEDERATION,
base::UTF8ToUTF16(form.federation_origin.host()));
std::unique_ptr<views::Label> label(new views::Label(text));
tapted 2017/05/10 05:30:11 CONTEXT_DEPRECATED_SMALL
Patti Lor 2017/05/11 06:59:18 Done.
- label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
+ label->SetFontList(views::style::GetFont(views::style::CONTEXT_LABEL,
+ views::style::STYLE_PRIMARY));
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
if (form.federation_origin.unique())
label->SetObscured(true);
@@ -113,8 +116,8 @@ std::unique_ptr<views::Label> GenerateDeletedPasswordLabel() {
std::unique_ptr<views::Label> text(new views::Label(
tapted 2017/05/10 05:30:11 CONTEXT_DEPRECATED_SMALL
Patti Lor 2017/05/11 06:59:18 Done.
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_DELETED)));
text->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- text->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
+ text->SetFontList(views::style::GetFont(views::style::CONTEXT_LABEL,
+ views::style::STYLE_PRIMARY));
return text;
}
@@ -124,8 +127,8 @@ std::unique_ptr<views::Link> GenerateUndoLink(views::LinkListener* listener) {
undo_link->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
undo_link->set_listener(listener);
undo_link->SetUnderline(false);
- undo_link->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
+ undo_link->SetFontList(views::style::GetFont(views::style::CONTEXT_LABEL,
tapted 2017/05/10 05:30:11 CONTEXT_DEPRECATED_SMALL
Patti Lor 2017/05/11 06:59:18 Done.
+ views::style::STYLE_LINK));
return undo_link;
}
@@ -292,8 +295,10 @@ void ManagePasswordItemsView::AddRows() {
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
for (const std::unique_ptr<PasswordFormRow>& row : password_forms_rows_) {
- if (row != password_forms_rows_[0])
- layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ if (row != password_forms_rows_[0]) {
+ layout->AddPaddingRow(0, ChromeLayoutProvider::Get()->GetDistanceMetric(
tapted 2017/05/10 05:30:11 ChromeLayoutProvider::Get() -> local var
Patti Lor 2017/05/11 06:59:18 Oops, thank you. I made DISTANCE_RELATED_CONTROL_V
+ views::DISTANCE_RELATED_CONTROL_VERTICAL));
+ }
row->AddRow(layout);
}
GetLayoutManager()->Layout(this);

Powered by Google App Engine
This is Rietveld 408576698