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

Unified Diff: ui/views/window/dialog_client_view.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 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
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | ui/views/window/dialog_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/dialog_client_view.cc
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index 5d543a7572efe2b85b8772f293c766cbdb19430f..3cd043e2eb325ade6518cbbba973ce97210df3ad 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -16,8 +16,8 @@
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/md_text_button.h"
#include "ui/views/layout/grid_layout.h"
+#include "ui/views/layout/layout_provider.h"
#include "ui/views/style/platform_style.h"
-#include "ui/views/views_delegate.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_delegate.h"
@@ -75,8 +75,8 @@ class DialogClientView::ButtonRowContainer : public View {
DialogClientView::DialogClientView(Widget* owner, View* contents_view)
: ClientView(owner, contents_view),
- button_row_insets_(ViewsDelegate::GetInstance()->GetInsetsMetric(
- InsetsMetric::DIALOG_BUTTON)) {
+ button_row_insets_(
+ LayoutProvider::Get()->GetInsetsMetric(INSETS_DIALOG_BUTTON)) {
// Doing this now ensures this accelerator will have lower priority than
// one set by the contents view.
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
@@ -281,8 +281,8 @@ void DialogClientView::UpdateDialogButton(LabelButton** member,
button = MdTextButton::CreateSecondaryUiButton(this, title);
}
- const int minimum_width = ViewsDelegate::GetInstance()->GetDistanceMetric(
- views::DistanceMetric::DIALOG_BUTTON_MINIMUM_WIDTH);
+ const int minimum_width = LayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH);
button->SetMinSize(gfx::Size(minimum_width, 0));
button->SetGroup(kButtonGroup);
@@ -301,8 +301,8 @@ int DialogClientView::GetExtraViewSpacing() const {
if (GetDialogDelegate()->GetExtraViewPadding(&extra_view_padding))
return extra_view_padding;
- return ViewsDelegate::GetInstance()->GetDistanceMetric(
- views::DistanceMetric::RELATED_BUTTON_HORIZONTAL);
+ return LayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_RELATED_BUTTON_HORIZONTAL);
}
std::array<View*, DialogClientView::kNumButtons>
@@ -341,8 +341,8 @@ void DialogClientView::SetupLayout() {
// They expect GetDialogRelatedControlVerticalSpacing() in this case.
// TODO(tapted): Remove this under Harmony.
if (insets.top() == 0) {
- const int top = ViewsDelegate::GetInstance()->GetDistanceMetric(
- views::DistanceMetric::RELATED_CONTROL_VERTICAL);
+ const int top = LayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_RELATED_CONTROL_VERTICAL);
insets.Set(top, insets.left(), insets.bottom(), insets.right());
}
@@ -356,8 +356,8 @@ void DialogClientView::SetupLayout() {
// GetExtraViewSpacing() handles <pad+stretchy>.
const int button_spacing =
(ok_button_ && cancel_button_)
- ? ViewsDelegate::GetInstance()->GetDistanceMetric(
- views::DistanceMetric::RELATED_BUTTON_HORIZONTAL)
+ ? LayoutProvider::Get()->GetDistanceMetric(
+ views::DISTANCE_RELATED_BUTTON_HORIZONTAL)
: 0;
constexpr int kButtonRowId = 0;
« no previous file with comments | « ui/views/widget/widget_interactive_uitest.cc ('k') | ui/views/window/dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698