| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/ui/views/payments/payment_request_dialog.h" | 12 #include "chrome/browser/ui/views/payments/payment_request_dialog.h" |
| 13 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 13 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/payments/payment_request.h" | 15 #include "components/payments/payment_request.h" |
| 16 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 17 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/gfx/color_utils.h" | 19 #include "ui/gfx/color_utils.h" |
| 20 #include "ui/gfx/font.h" | 20 #include "ui/gfx/font.h" |
| 21 #include "ui/gfx/geometry/insets.h" | 21 #include "ui/gfx/geometry/insets.h" |
| 22 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
| 23 #include "ui/gfx/range/range.h" | 23 #include "ui/gfx/range/range.h" |
| 24 #include "ui/gfx/vector_icons_public.h" | |
| 25 #include "ui/views/border.h" | 24 #include "ui/views/border.h" |
| 26 #include "ui/views/controls/button/custom_button.h" | 25 #include "ui/views/controls/button/custom_button.h" |
| 27 #include "ui/views/controls/button/label_button.h" | 26 #include "ui/views/controls/button/label_button.h" |
| 28 #include "ui/views/controls/button/md_text_button.h" | 27 #include "ui/views/controls/button/md_text_button.h" |
| 29 #include "ui/views/controls/image_view.h" | 28 #include "ui/views/controls/image_view.h" |
| 30 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
| 31 #include "ui/views/controls/styled_label.h" | 30 #include "ui/views/controls/styled_label.h" |
| 32 #include "ui/views/layout/grid_layout.h" | 31 #include "ui/views/layout/grid_layout.h" |
| 32 #include "ui/views/resources/vector_icons/vector_icons.h" |
| 33 #include "ui/views/view.h" | 33 #include "ui/views/view.h" |
| 34 | 34 |
| 35 namespace payments { | 35 namespace payments { |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 enum class PaymentSheetViewControllerTags { | 38 enum class PaymentSheetViewControllerTags { |
| 39 // The tag for the button that navigates to the Order Summary sheet. | 39 // The tag for the button that navigates to the Order Summary sheet. |
| 40 SHOW_ORDER_SUMMARY_BUTTON = static_cast<int>( | 40 SHOW_ORDER_SUMMARY_BUTTON = static_cast<int>( |
| 41 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX), | 41 payments::PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX), |
| 42 }; | 42 }; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 if (extra_content_view) { | 98 if (extra_content_view) { |
| 99 layout->AddView(extra_content_view.release()); | 99 layout->AddView(extra_content_view.release()); |
| 100 } else { | 100 } else { |
| 101 layout->SkipColumns(1); | 101 layout->SkipColumns(1); |
| 102 } | 102 } |
| 103 | 103 |
| 104 views::ImageView* chevron = new views::ImageView(); | 104 views::ImageView* chevron = new views::ImageView(); |
| 105 chevron->SetImage(gfx::CreateVectorIcon( | 105 chevron->SetImage(gfx::CreateVectorIcon( |
| 106 gfx::VectorIconId::SUBMENU_ARROW, | 106 views::kSubmenuArrowIcon, |
| 107 color_utils::DeriveDefaultIconColor(name_label->enabled_color()))); | 107 color_utils::DeriveDefaultIconColor(name_label->enabled_color()))); |
| 108 layout->AddView(chevron); | 108 layout->AddView(chevron); |
| 109 } | 109 } |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(PaymentSheetRow); | 111 DISALLOW_COPY_AND_ASSIGN(PaymentSheetRow); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace | 114 } // namespace |
| 115 | 115 |
| 116 PaymentSheetViewController::PaymentSheetViewController( | 116 PaymentSheetViewController::PaymentSheetViewController( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 this, | 172 this, |
| 173 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME), | 173 l10n_util::GetStringUTF16(IDS_PAYMENT_REQUEST_ORDER_SUMMARY_SECTION_NAME), |
| 174 std::unique_ptr<views::View>(nullptr), | 174 std::unique_ptr<views::View>(nullptr), |
| 175 CreateOrderSummarySectionContent()); | 175 CreateOrderSummarySectionContent()); |
| 176 section->set_tag(static_cast<int>( | 176 section->set_tag(static_cast<int>( |
| 177 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); | 177 PaymentSheetViewControllerTags::SHOW_ORDER_SUMMARY_BUTTON)); |
| 178 return section; | 178 return section; |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace payments | 181 } // namespace payments |
| OLD | NEW |