| 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_dialog_view_ids.h" | 8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 10 #include "components/payments/content/payment_request.h" | 10 #include "components/payments/content/payment_request.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 FillContentView(content_view_); | 34 FillContentView(content_view_); |
| 35 | 35 |
| 36 return CreatePaymentView(); | 36 return CreatePaymentView(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void PaymentRequestSheetController::UpdateContentView() { | 39 void PaymentRequestSheetController::UpdateContentView() { |
| 40 content_view_->RemoveAllChildViews(true); | 40 content_view_->RemoveAllChildViews(true); |
| 41 FillContentView(content_view_); | 41 FillContentView(content_view_); |
| 42 content_view_->Layout(); | 42 content_view_->Layout(); |
| 43 pane_->SizeToPreferredSize(); | 43 pane_->SizeToPreferredSize(); |
| 44 // Now that the content and its surrounding pane are updated, force a Layout |
| 45 // on the ScrollView so that it updates its scroll bars now. |
| 46 scroll_->Layout(); |
| 44 } | 47 } |
| 45 | 48 |
| 46 std::unique_ptr<views::Button> | 49 std::unique_ptr<views::Button> |
| 47 PaymentRequestSheetController::CreatePrimaryButton() { | 50 PaymentRequestSheetController::CreatePrimaryButton() { |
| 48 return nullptr; | 51 return nullptr; |
| 49 } | 52 } |
| 50 | 53 |
| 51 base::string16 PaymentRequestSheetController::GetSecondaryButtonLabel() { | 54 base::string16 PaymentRequestSheetController::GetSecondaryButtonLabel() { |
| 52 return l10n_util::GetStringUTF16(IDS_CANCEL); | 55 return l10n_util::GetStringUTF16(IDS_CANCEL); |
| 53 } | 56 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 views::GridLayout* pane_layout = new views::GridLayout(pane_); | 113 views::GridLayout* pane_layout = new views::GridLayout(pane_); |
| 111 views::ColumnSet* pane_columns = pane_layout->AddColumnSet(0); | 114 views::ColumnSet* pane_columns = pane_layout->AddColumnSet(0); |
| 112 pane_columns->AddColumn( | 115 pane_columns->AddColumn( |
| 113 views::GridLayout::Alignment::FILL, views::GridLayout::Alignment::LEADING, | 116 views::GridLayout::Alignment::FILL, views::GridLayout::Alignment::LEADING, |
| 114 0, views::GridLayout::SizeType::FIXED, kDialogWidth, kDialogWidth); | 117 0, views::GridLayout::SizeType::FIXED, kDialogWidth, kDialogWidth); |
| 115 pane_->SetLayoutManager(pane_layout); | 118 pane_->SetLayoutManager(pane_layout); |
| 116 pane_layout->StartRow(0, 0); | 119 pane_layout->StartRow(0, 0); |
| 117 pane_layout->AddView(content_view_); | 120 pane_layout->AddView(content_view_); |
| 118 pane_->SizeToPreferredSize(); | 121 pane_->SizeToPreferredSize(); |
| 119 | 122 |
| 120 std::unique_ptr<views::ScrollView> scroll = | 123 scroll_ = base::MakeUnique<views::ScrollView>(); |
| 121 base::MakeUnique<views::ScrollView>(); | 124 scroll_->set_owned_by_client(); |
| 122 scroll->EnableViewPortLayer(); | 125 scroll_->EnableViewPortLayer(); |
| 123 scroll->set_hide_horizontal_scrollbar(true); | 126 scroll_->set_hide_horizontal_scrollbar(true); |
| 124 scroll->SetContents(pane_); | 127 scroll_->SetContents(pane_); |
| 125 layout->AddView(scroll.release()); | 128 layout->AddView(scroll_.get()); |
| 126 | 129 |
| 127 layout->StartRow(0, 0); | 130 layout->StartRow(0, 0); |
| 128 layout->AddView(CreateFooterView().release()); | 131 layout->AddView(CreateFooterView().release()); |
| 129 | 132 |
| 130 return view; | 133 return view; |
| 131 } | 134 } |
| 132 | 135 |
| 133 std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() { | 136 std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() { |
| 134 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); | 137 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); |
| 135 | 138 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); | 176 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); |
| 174 button->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON)); | 177 button->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON)); |
| 175 trailing_buttons_container->AddChildView(button); | 178 trailing_buttons_container->AddChildView(button); |
| 176 | 179 |
| 177 layout->AddView(trailing_buttons_container.release()); | 180 layout->AddView(trailing_buttons_container.release()); |
| 178 | 181 |
| 179 return container; | 182 return container; |
| 180 } | 183 } |
| 181 | 184 |
| 182 } // namespace payments | 185 } // namespace payments |
| OLD | NEW |