Chromium Code Reviews| Index: chrome/browser/ui/views/passwords/credentials_item_view.cc |
| diff --git a/chrome/browser/ui/views/passwords/credentials_item_view.cc b/chrome/browser/ui/views/passwords/credentials_item_view.cc |
| index e37ef4fe62f2d78fcabda6311c09e31200fb9ecd..5aafc9466aa8b668848d992912a3b6c045ac748d 100644 |
| --- a/chrome/browser/ui/views/passwords/credentials_item_view.cc |
| +++ b/chrome/browser/ui/views/passwords/credentials_item_view.cc |
| @@ -7,11 +7,11 @@ |
| #include "base/macros.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/ui/passwords/manage_passwords_view_utils.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 "chrome/grit/theme_resources.h" |
| #include "components/autofill/core/common/password_form.h" |
| -#include "ui/base/material_design/material_design_controller.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/path.h" |
| @@ -22,8 +22,6 @@ |
| #include "ui/views/layout/layout_constants.h" |
| namespace { |
| -// The default spacing between the icon and text. |
| -const int kSpacing = 12; |
| gfx::Size GetTextLabelsSize(const views::Label* upper_label, |
| const views::Label* lower_label) { |
| @@ -94,10 +92,9 @@ CredentialsItemView::CredentialsItemView( |
| // TODO(tapted): Check these (and the STYLE_ values below) against the spec on |
| // http://crbug.com/651681. |
| - const int kLabelContext = |
| - ui::MaterialDesignController::IsSecondaryUiMaterial() |
| - ? CONTEXT_BODY_TEXT_SMALL |
| - : CONTEXT_DEPRECATED_SMALL; |
| + const int kLabelContext = ChromeLayoutProvider::Get()->IsHarmonyMode() |
| + ? CONTEXT_BODY_TEXT_SMALL |
| + : CONTEXT_DEPRECATED_SMALL; |
| if (!upper_text.empty()) { |
| upper_label_ = new views::Label(upper_text, kLabelContext, |
| @@ -152,7 +149,9 @@ gfx::Size CredentialsItemView::GetPreferredSize() const { |
| std::max(kAvatarImageSize, labels_size.height())); |
| const gfx::Insets insets(GetInsets()); |
| size.Enlarge(insets.width(), insets.height()); |
| - size.Enlarge(kSpacing, 0); |
| + size.Enlarge(ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_HORIZONTAL), |
|
Peter Kasting
2017/04/24 22:48:31
Semantically, should this and the one below be REL
kylix_rd
2017/04/25 17:14:07
The kSpacing value was 12, so I chose the element
|
| + 0); |
| // Make the size at least as large as the minimum size needed by the border. |
| size.SetToMax(border() ? border()->GetMinimumSize() : gfx::Size()); |
| @@ -179,7 +178,9 @@ void CredentialsItemView::Layout() { |
| lower_label_ ? lower_label_->GetPreferredSize() : gfx::Size(); |
| int y_offset = (child_area.height() - |
| (upper_size.height() + lower_size.height())) / 2; |
| - gfx::Point label_origin(image_origin.x() + image_size.width() + kSpacing, |
| + gfx::Point label_origin(image_origin.x() + image_size.width() + |
| + ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_HORIZONTAL), |
| child_area.origin().y() + y_offset); |
| if (upper_label_) |
| upper_label_->SetBoundsRect(gfx::Rect(label_origin, upper_size)); |