| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 static_cast<AutofillPaymentInstrument*>(instrument_) | 85 static_cast<AutofillPaymentInstrument*>(instrument_) |
| 86 ->credit_card()); | 86 ->credit_card()); |
| 87 return; | 87 return; |
| 88 } | 88 } |
| 89 NOTREACHED(); | 89 NOTREACHED(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // payments::PaymentRequestItemList::Item: | 92 // payments::PaymentRequestItemList::Item: |
| 93 std::unique_ptr<views::View> CreateExtraView() override { | 93 std::unique_ptr<views::View> CreateExtraView() override { |
| 94 std::unique_ptr<views::ImageView> card_icon_view = CreateInstrumentIconView( | 94 std::unique_ptr<views::ImageView> card_icon_view = CreateInstrumentIconView( |
| 95 instrument_->icon_resource_id(), instrument_->label()); | 95 instrument_->icon_resource_id(), instrument_->GetLabel()); |
| 96 card_icon_view->SetImageSize(gfx::Size(32, 20)); | 96 card_icon_view->SetImageSize(gfx::Size(32, 20)); |
| 97 return std::move(card_icon_view); | 97 return std::move(card_icon_view); |
| 98 } | 98 } |
| 99 | 99 |
| 100 std::unique_ptr<views::View> CreateContentView() override { | 100 std::unique_ptr<views::View> CreateContentView() override { |
| 101 std::unique_ptr<views::View> card_info_container = | 101 std::unique_ptr<views::View> card_info_container = |
| 102 base::MakeUnique<views::View>(); | 102 base::MakeUnique<views::View>(); |
| 103 card_info_container->set_can_process_events_within_subtree(false); | 103 card_info_container->set_can_process_events_within_subtree(false); |
| 104 | 104 |
| 105 std::unique_ptr<views::BoxLayout> box_layout = | 105 std::unique_ptr<views::BoxLayout> box_layout = |
| 106 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, | 106 base::MakeUnique<views::BoxLayout>(views::BoxLayout::kVertical, 0, |
| 107 kPaymentRequestRowVerticalInsets, 0); | 107 kPaymentRequestRowVerticalInsets, 0); |
| 108 box_layout->set_cross_axis_alignment( | 108 box_layout->set_cross_axis_alignment( |
| 109 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); | 109 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
| 110 card_info_container->SetLayoutManager(box_layout.release()); | 110 card_info_container->SetLayoutManager(box_layout.release()); |
| 111 | 111 |
| 112 if (!instrument_->label().empty()) | 112 base::string16 label = instrument_->GetLabel(); |
| 113 card_info_container->AddChildView(new views::Label(instrument_->label())); | 113 if (!label.empty()) |
| 114 if (!instrument_->sublabel().empty()) { | 114 card_info_container->AddChildView(new views::Label(label)); |
| 115 card_info_container->AddChildView( | 115 base::string16 sublabel = instrument_->GetSublabel(); |
| 116 new views::Label(instrument_->sublabel())); | 116 if (!sublabel.empty()) |
| 117 } | 117 card_info_container->AddChildView(new views::Label(sublabel)); |
| 118 if (!instrument_->IsCompleteForPayment()) { | 118 if (!instrument_->IsCompleteForPayment()) { |
| 119 std::unique_ptr<views::Label> missing_info_label = | 119 std::unique_ptr<views::Label> missing_info_label = |
| 120 base::MakeUnique<views::Label>(instrument_->GetMissingInfoLabel(), | 120 base::MakeUnique<views::Label>(instrument_->GetMissingInfoLabel(), |
| 121 CONTEXT_DEPRECATED_SMALL); | 121 CONTEXT_DEPRECATED_SMALL); |
| 122 missing_info_label->SetEnabledColor( | 122 missing_info_label->SetEnabledColor( |
| 123 missing_info_label->GetNativeTheme()->GetSystemColor( | 123 missing_info_label->GetNativeTheme()->GetSystemColor( |
| 124 ui::NativeTheme::kColorId_LinkEnabled)); | 124 ui::NativeTheme::kColorId_LinkEnabled)); |
| 125 card_info_container->AddChildView(missing_info_label.release()); | 125 card_info_container->AddChildView(missing_info_label.release()); |
| 126 } | 126 } |
| 127 | 127 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 base::Unretained(state()), /*selected=*/true), | 224 base::Unretained(state()), /*selected=*/true), |
| 225 /*credit_card=*/nullptr); | 225 /*credit_card=*/nullptr); |
| 226 break; | 226 break; |
| 227 default: | 227 default: |
| 228 PaymentRequestSheetController::ButtonPressed(sender, event); | 228 PaymentRequestSheetController::ButtonPressed(sender, event); |
| 229 break; | 229 break; |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace payments | 233 } // namespace payments |
| OLD | NEW |