Chromium Code Reviews| 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 <string> | |
| 9 #include <utility> | 10 #include <utility> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 18 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 18 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 19 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 19 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" | 20 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" |
| 20 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 21 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/autofill/core/browser/autofill_type.h" | 23 #include "components/autofill/core/browser/autofill_type.h" |
| 23 #include "components/autofill/core/browser/credit_card.h" | 24 #include "components/autofill/core/browser/credit_card.h" |
| 24 #include "components/autofill/core/browser/field_types.h" | 25 #include "components/autofill/core/browser/field_types.h" |
| 25 #include "components/autofill/core/browser/personal_data_manager.h" | 26 #include "components/autofill/core/browser/personal_data_manager.h" |
| 26 #include "components/payments/core/currency_formatter.h" | 27 #include "components/payments/core/currency_formatter.h" |
| 27 #include "components/strings/grit/components_strings.h" | 28 #include "components/strings/grit/components_strings.h" |
| 28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/gfx/color_utils.h" | 31 #include "ui/gfx/color_utils.h" |
| 31 #include "ui/gfx/font.h" | 32 #include "ui/gfx/font.h" |
| 32 #include "ui/gfx/paint_vector_icon.h" | 33 #include "ui/gfx/paint_vector_icon.h" |
| 33 #include "ui/gfx/range/range.h" | 34 #include "ui/gfx/range/range.h" |
| 34 #include "ui/views/controls/button/md_text_button.h" | 35 #include "ui/views/controls/button/md_text_button.h" |
| 35 #include "ui/views/controls/image_view.h" | 36 #include "ui/views/controls/image_view.h" |
| 36 #include "ui/views/controls/label.h" | 37 #include "ui/views/controls/label.h" |
| 37 #include "ui/views/controls/styled_label.h" | 38 #include "ui/views/controls/styled_label.h" |
| 38 #include "ui/views/layout/fill_layout.h" | |
| 39 #include "ui/views/layout/grid_layout.h" | 39 #include "ui/views/layout/grid_layout.h" |
| 40 #include "ui/views/vector_icons.h" | 40 #include "ui/views/vector_icons.h" |
| 41 #include "ui/views/view.h" | 41 #include "ui/views/view.h" |
| 42 | 42 |
| 43 namespace payments { | 43 namespace payments { |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 constexpr int kFirstTagValue = static_cast<int>( | 46 constexpr int kFirstTagValue = static_cast<int>( |
| 47 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); | 47 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX); |
| 48 | 48 |
| (...skipping 128 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 layout->StartRow(0, 0); | 187 layout->StartRow(0, 0); |
|
Mathieu
2017/03/02 17:00:13
needs rebase
anthonyvd
2017/03/02 18:24:21
Done, thanks!
| |
| 188 layout->AddView(CreatePaymentSheetSummaryRow().release()); | 188 layout->AddView(CreatePaymentSheetSummaryRow().release()); |
| 189 layout->StartRow(1, 0); | 189 layout->StartRow(0, 0); |
| 190 layout->AddView(CreateShippingRow().release()); | 190 layout->AddView(CreateShippingRow().release()); |
| 191 layout->StartRow(0, 0); | 191 layout->StartRow(0, 0); |
| 192 layout->AddView(CreatePaymentMethodRow().release()); | 192 layout->AddView(CreatePaymentMethodRow().release()); |
| 193 layout->StartRow(1, 0); | 193 layout->StartRow(0, 0); |
| 194 layout->AddView(CreateContactInfoRow().release()); | 194 layout->AddView(CreateContactInfoRow().release()); |
| 195 | 195 |
| 196 return CreatePaymentView( | 196 return CreatePaymentView( |
| 197 CreateSheetHeaderView( | 197 CreateSheetHeaderView( |
| 198 false, | 198 false, |
| 199 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), | 199 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_PAYMENT_SHEET_TITLE), |
| 200 this), | 200 this), |
| 201 std::move(content_view)); | 201 std::move(content_view)); |
| 202 } | 202 } |
| 203 | 203 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), | 388 CreateContactInfoSectionContent(), std::unique_ptr<views::View>(nullptr), |
| 389 widest_name_column_view_width_); | 389 widest_name_column_view_width_); |
| 390 section->set_tag(static_cast<int>( | 390 section->set_tag(static_cast<int>( |
| 391 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); | 391 PaymentSheetViewControllerTags::SHOW_CONTACT_INFO_BUTTON)); |
| 392 section->set_id( | 392 section->set_id( |
| 393 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); | 393 static_cast<int>(DialogViewID::PAYMENT_SHEET_CONTACT_INFO_SECTION)); |
| 394 return section; | 394 return section; |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace payments | 397 } // namespace payments |
| OLD | NEW |