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_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 11 matching lines...) Expand all Loading... | |
| 22 PaymentRequestSheetController::PaymentRequestSheetController( | 22 PaymentRequestSheetController::PaymentRequestSheetController( |
| 23 PaymentRequestSpec* spec, | 23 PaymentRequestSpec* spec, |
| 24 PaymentRequestState* state, | 24 PaymentRequestState* state, |
| 25 PaymentRequestDialogView* dialog) | 25 PaymentRequestDialogView* dialog) |
| 26 : spec_(spec), state_(state), dialog_(dialog) {} | 26 : spec_(spec), state_(state), dialog_(dialog) {} |
| 27 | 27 |
| 28 PaymentRequestSheetController::~PaymentRequestSheetController() {} | 28 PaymentRequestSheetController::~PaymentRequestSheetController() {} |
| 29 | 29 |
| 30 std::unique_ptr<views::View> PaymentRequestSheetController::CreateView() { | 30 std::unique_ptr<views::View> PaymentRequestSheetController::CreateView() { |
| 31 // This is owned by its parent. | 31 // This is owned by its parent. |
| 32 content_view_ = new views::View; | 32 content_view_ = new views::View; |
|
Mathieu
2017/04/26 13:17:06
I'm wondering if this line can be inside CreatePay
anthonyvd
2017/04/26 13:33:44
Great point, done.
| |
| 33 | 33 std::unique_ptr<views::View> view = CreatePaymentView(); |
| 34 FillContentView(content_view_); | 34 UpdateContentView(); |
| 35 | 35 return view; |
| 36 return CreatePaymentView(); | |
| 37 } | 36 } |
| 38 | 37 |
| 39 void PaymentRequestSheetController::UpdateContentView() { | 38 void PaymentRequestSheetController::UpdateContentView() { |
| 40 content_view_->RemoveAllChildViews(true); | 39 content_view_->RemoveAllChildViews(true); |
| 41 FillContentView(content_view_); | 40 FillContentView(content_view_); |
| 42 content_view_->Layout(); | 41 content_view_->Layout(); |
| 43 pane_->SizeToPreferredSize(); | 42 pane_->SizeToPreferredSize(); |
| 44 } | 43 } |
| 45 | 44 |
| 46 std::unique_ptr<views::Button> | 45 std::unique_ptr<views::Button> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); | 172 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); |
| 174 button->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON)); | 173 button->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON)); |
| 175 trailing_buttons_container->AddChildView(button); | 174 trailing_buttons_container->AddChildView(button); |
| 176 | 175 |
| 177 layout->AddView(trailing_buttons_container.release()); | 176 layout->AddView(trailing_buttons_container.release()); |
| 178 | 177 |
| 179 return container; | 178 return container; |
| 180 } | 179 } |
| 181 | 180 |
| 182 } // namespace payments | 181 } // namespace payments |
| OLD | NEW |