| 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_method_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/payment_method_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" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 card_info_container->AddChildView( | 103 card_info_container->AddChildView( |
| 104 new views::Label(card_->TypeAndLastFourDigits())); | 104 new views::Label(card_->TypeAndLastFourDigits())); |
| 105 card_info_container->AddChildView(new views::Label( | 105 card_info_container->AddChildView(new views::Label( |
| 106 card_->GetInfo(autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), | 106 card_->GetInfo(autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), |
| 107 g_browser_process->GetApplicationLocale()))); | 107 g_browser_process->GetApplicationLocale()))); |
| 108 // TODO(anthonyvd): Add the "card is incomplete" label once the | 108 // TODO(anthonyvd): Add the "card is incomplete" label once the |
| 109 // completedness logic is implemented. | 109 // completedness logic is implemented. |
| 110 layout->AddView(card_info_container.release()); | 110 layout->AddView(card_info_container.release()); |
| 111 | 111 |
| 112 checkmark_ = base::MakeUnique<views::ImageView>(); | 112 checkmark_ = CreateCheckmark(selected()); |
| 113 checkmark_->set_id( | |
| 114 static_cast<int>(DialogViewID::PAYMENT_METHOD_ITEM_CHECKMARK_VIEW)); | |
| 115 checkmark_->set_owned_by_client(); | |
| 116 checkmark_->set_can_process_events_within_subtree(false); | |
| 117 checkmark_->SetImage( | |
| 118 gfx::CreateVectorIcon(views::kMenuCheckIcon, 0xFF609265)); | |
| 119 layout->AddView(checkmark_.get()); | 113 layout->AddView(checkmark_.get()); |
| 120 if (!selected()) | |
| 121 checkmark_->SetVisible(false); | |
| 122 | 114 |
| 123 std::unique_ptr<views::ImageView> card_icon_view = | 115 std::unique_ptr<views::ImageView> card_icon_view = |
| 124 CreateCardIconView(card_->type()); | 116 CreateCardIconView(card_->type()); |
| 125 card_icon_view->SetImageSize(gfx::Size(32, 20)); | 117 card_icon_view->SetImageSize(gfx::Size(32, 20)); |
| 126 layout->AddView(card_icon_view.release()); | 118 layout->AddView(card_icon_view.release()); |
| 127 | 119 |
| 128 return std::move(row); | 120 return std::move(row); |
| 129 } | 121 } |
| 130 | 122 |
| 131 void SelectedStateChanged() override { | 123 void SelectedStateChanged() override { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 PaymentMethodViewControllerTags::ADD_CREDIT_CARD_BUTTON): | 211 PaymentMethodViewControllerTags::ADD_CREDIT_CARD_BUTTON): |
| 220 dialog()->ShowCreditCardEditor(); | 212 dialog()->ShowCreditCardEditor(); |
| 221 break; | 213 break; |
| 222 default: | 214 default: |
| 223 PaymentRequestSheetController::ButtonPressed(sender, event); | 215 PaymentRequestSheetController::ButtonPressed(sender, event); |
| 224 break; | 216 break; |
| 225 } | 217 } |
| 226 } | 218 } |
| 227 | 219 |
| 228 } // namespace payments | 220 } // namespace payments |
| OLD | NEW |