Commit a29081ac authored by anthonyvd's avatar anthonyvd Committed by Commit bot

[Web Payments] Respect Harmony dialog width in Payment Request

BUG=716076

Review-Url: https://codereview.chromium.org/2846053002
Cr-Commit-Position: refs/heads/master@{#467757}
parent a0935db6
...@@ -332,7 +332,7 @@ void PaymentRequestDialogView::SetupSpinnerOverlay() { ...@@ -332,7 +332,7 @@ void PaymentRequestDialogView::SetupSpinnerOverlay() {
} }
gfx::Size PaymentRequestDialogView::GetPreferredSize() const { gfx::Size PaymentRequestDialogView::GetPreferredSize() const {
return gfx::Size(kDialogWidth, kDialogHeight); return gfx::Size(GetActualDialogWidth(), kDialogHeight);
} }
void PaymentRequestDialogView::ViewHierarchyChanged( void PaymentRequestDialogView::ViewHierarchyChanged(
......
...@@ -109,9 +109,10 @@ PaymentRequestSheetController::CreatePaymentView() { ...@@ -109,9 +109,10 @@ PaymentRequestSheetController::CreatePaymentView() {
pane_ = new views::View; pane_ = new views::View;
views::GridLayout* pane_layout = new views::GridLayout(pane_); views::GridLayout* pane_layout = new views::GridLayout(pane_);
views::ColumnSet* pane_columns = pane_layout->AddColumnSet(0); views::ColumnSet* pane_columns = pane_layout->AddColumnSet(0);
pane_columns->AddColumn( pane_columns->AddColumn(views::GridLayout::Alignment::FILL,
views::GridLayout::Alignment::FILL, views::GridLayout::Alignment::LEADING, views::GridLayout::Alignment::LEADING, 0,
0, views::GridLayout::SizeType::FIXED, kDialogWidth, kDialogWidth); views::GridLayout::SizeType::FIXED,
GetActualDialogWidth(), GetActualDialogWidth());
pane_->SetLayoutManager(pane_layout); pane_->SetLayoutManager(pane_layout);
pane_layout->StartRow(0, 0); pane_layout->StartRow(0, 0);
// This is owned by its parent. It's the container passed to FillContentView. // This is owned by its parent. It's the container passed to FillContentView.
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "ui/views/controls/styled_label.h" #include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/grid_layout.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/painter.h" #include "ui/views/painter.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -130,6 +131,13 @@ class PaymentRequestRowBorderPainter : public views::Painter { ...@@ -130,6 +131,13 @@ class PaymentRequestRowBorderPainter : public views::Painter {
} // namespace } // namespace
int GetActualDialogWidth() {
constexpr int kDialogMinWidth = 512;
static int actual_width =
views::LayoutProvider::Get()->GetSnappedDialogWidth(kDialogMinWidth);
return actual_width;
}
std::unique_ptr<views::View> CreateSheetHeaderView( std::unique_ptr<views::View> CreateSheetHeaderView(
bool show_back_arrow, bool show_back_arrow,
const base::string16& title, const base::string16& title,
......
...@@ -37,7 +37,6 @@ constexpr int kPaymentRequestRowExtraRightInset = 8; ...@@ -37,7 +37,6 @@ constexpr int kPaymentRequestRowExtraRightInset = 8;
constexpr int kPaymentRequestButtonSpacing = 10; constexpr int kPaymentRequestButtonSpacing = 10;
// Dimensions of the dialog itself. // Dimensions of the dialog itself.
constexpr int kDialogWidth = 450;
constexpr int kDialogHeight = 450; constexpr int kDialogHeight = 450;
enum class PaymentRequestCommonTags { enum class PaymentRequestCommonTags {
...@@ -50,6 +49,8 @@ enum class PaymentRequestCommonTags { ...@@ -50,6 +49,8 @@ enum class PaymentRequestCommonTags {
PAYMENT_REQUEST_COMMON_TAG_MAX PAYMENT_REQUEST_COMMON_TAG_MAX
}; };
int GetActualDialogWidth();
// Creates and returns a header for all the sheets in the PaymentRequest dialog. // Creates and returns a header for all the sheets in the PaymentRequest dialog.
// The header contains an optional back arrow button (if |show_back_arrow| is // The header contains an optional back arrow button (if |show_back_arrow| is
// true), a |title| label. |delegate| becomes the delegate for the back and // true), a |title| label. |delegate| becomes the delegate for the back and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment