| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_sheet_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/payment_sheet_view_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 std::unique_ptr<views::View> PaymentSheetViewController::CreateView() { | 178 std::unique_ptr<views::View> PaymentSheetViewController::CreateView() { |
| 179 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); | 179 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); |
| 180 | 180 |
| 181 views::GridLayout* layout = new views::GridLayout(content_view.get()); | 181 views::GridLayout* layout = new views::GridLayout(content_view.get()); |
| 182 content_view->SetLayoutManager(layout); | 182 content_view->SetLayoutManager(layout); |
| 183 views::ColumnSet* columns = layout->AddColumnSet(0); | 183 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 184 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, | 184 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, |
| 185 1, views::GridLayout::USE_PREF, 0, 0); | 185 1, views::GridLayout::USE_PREF, 0, 0); |
| 186 | 186 |
| 187 // The shipping address and contact info rows are optional. |
| 187 layout->StartRow(0, 0); | 188 layout->StartRow(0, 0); |
| 188 layout->AddView(CreatePaymentSheetSummaryRow().release()); | 189 layout->AddView(CreatePaymentSheetSummaryRow().release()); |
| 189 layout->StartRow(1, 0); | 190 if (request()->request_shipping()) { |
| 190 layout->AddView(CreateShippingRow().release()); | 191 layout->StartRow(1, 0); |
| 192 layout->AddView(CreateShippingRow().release()); |
| 193 } |
| 191 layout->StartRow(0, 0); | 194 layout->StartRow(0, 0); |
| 192 layout->AddView(CreatePaymentMethodRow().release()); | 195 layout->AddView(CreatePaymentMethodRow().release()); |
| 193 layout->StartRow(1, 0); | 196 if (request()->request_payer_name() || request()->request_payer_email() || |
| 194 layout->AddView(CreateContactInfoRow().release()); | 197 request()->request_payer_phone()) { |
| 198 layout->StartRow(1, 0); |
| 199 layout->AddView(CreateContactInfoRow().release()); |
| 200 } |
| 195 | 201 |
| 196 return CreatePaymentView( | 202 return CreatePaymentView( |
| 197 CreateSheetHeaderView( | 203 CreateSheetHeaderView( |
| 198 false, | 204 false, |
| 199 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), | 205 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), |
| 200 this), | 206 this), |
| 201 std::move(content_view)); | 207 std::move(content_view)); |
| 202 } | 208 } |
| 203 | 209 |
| 204 std::unique_ptr<views::Button> | 210 std::unique_ptr<views::Button> |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), | 394 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), |
| 389 widest_name_column_view_width_); | 395 widest_name_column_view_width_); |
| 390 section->set_tag(static_cast<int>( | 396 section->set_tag(static_cast<int>( |
| 391 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); | 397 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); |
| 392 section->set_id( | 398 section->set_id( |
| 393 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); | 399 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); |
| 394 return section; | 400 return section; |
| 395 } | 401 } |
| 396 | 402 |
| 397 } // namespace payments | 403 } // namespace payments |
| OLD | NEW |