Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 9 #include "components/payments/content/payment_request.h" | 9 #include "components/payments/content/payment_request.h" |
| 10 #include "components/strings/grit/components_strings.h" | 10 #include "components/strings/grit/components_strings.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 layout->StartRow(0, 0); | 93 layout->StartRow(0, 0); |
| 94 // |header_view| will be deleted when |view| is. | 94 // |header_view| will be deleted when |view| is. |
| 95 layout->AddView( | 95 layout->AddView( |
| 96 CreateSheetHeaderView(ShouldShowHeaderBackArrow(), GetSheetTitle(), this) | 96 CreateSheetHeaderView(ShouldShowHeaderBackArrow(), GetSheetTitle(), this) |
| 97 .release()); | 97 .release()); |
| 98 | 98 |
| 99 layout->StartRow(1, 0); | 99 layout->StartRow(1, 0); |
| 100 // |content_view| will go into a views::ScrollView so it needs to be sized now | 100 // |content_view| will go into a views::ScrollView so it needs to be sized now |
| 101 // otherwise it'll be sized to the ScrollView's viewport height, preventing | 101 // otherwise it'll be sized to the ScrollView's viewport height, preventing |
| 102 // the scroll bar from ever being shown. | 102 // the scroll bar from ever being shown. |
| 103 content_view_->SizeToPreferredSize(); | 103 views::View* pane = new views::View; |
|
Mathieu
2017/03/30 14:37:32
can this be a separate change? this is to limit th
| |
| 104 views::GridLayout* pane_layout = new views::GridLayout(pane); | |
| 105 views::ColumnSet* pane_columns = pane_layout->AddColumnSet(0); | |
| 106 pane_columns->AddColumn(views::GridLayout::Alignment::FILL, | |
| 107 views::GridLayout::Alignment::LEADING, 0, | |
| 108 views::GridLayout::SizeType::FIXED, 450, 450); | |
| 109 pane->SetLayoutManager(pane_layout); | |
| 110 pane_layout->StartRow(0, 0); | |
| 111 pane_layout->AddView(content_view_); | |
| 112 pane->SizeToPreferredSize(); | |
| 104 | 113 |
| 105 std::unique_ptr<views::ScrollView> scroll = | 114 std::unique_ptr<views::ScrollView> scroll = |
| 106 base::MakeUnique<views::ScrollView>(); | 115 base::MakeUnique<views::ScrollView>(); |
| 107 scroll->EnableViewPortLayer(); | 116 scroll->EnableViewPortLayer(); |
| 108 scroll->set_hide_horizontal_scrollbar(true); | 117 scroll->set_hide_horizontal_scrollbar(true); |
| 109 scroll->SetContents(content_view_); | 118 scroll->SetContents(pane); |
| 110 layout->AddView(scroll.release()); | 119 layout->AddView(scroll.release()); |
| 111 | 120 |
| 112 layout->StartRow(0, 0); | 121 layout->StartRow(0, 0); |
| 113 layout->AddView(CreateFooterView().release()); | 122 layout->AddView(CreateFooterView().release()); |
| 114 | 123 |
| 115 return view; | 124 return view; |
| 116 } | 125 } |
| 117 | 126 |
| 118 std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() { | 127 std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() { |
| 119 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); | 128 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 this, l10n_util::GetStringUTF16(IDS_CANCEL)); | 166 this, l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 158 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); | 167 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); |
| 159 trailing_buttons_container->AddChildView(button); | 168 trailing_buttons_container->AddChildView(button); |
| 160 | 169 |
| 161 layout->AddView(trailing_buttons_container.release()); | 170 layout->AddView(trailing_buttons_container.release()); |
| 162 | 171 |
| 163 return container; | 172 return container; |
| 164 } | 173 } |
| 165 | 174 |
| 166 } // namespace payments | 175 } // namespace payments |
| OLD | NEW |