| 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_request_views_util.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 views::Label* title_label = new views::Label(title); | 164 views::Label* title_label = new views::Label(title); |
| 165 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 165 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 166 title_label->SetFontList( | 166 title_label->SetFontList( |
| 167 title_label->GetDefaultFontList().DeriveWithSizeDelta(2)); | 167 title_label->GetDefaultFontList().DeriveWithSizeDelta(2)); |
| 168 layout->AddView(title_label); | 168 layout->AddView(title_label); |
| 169 | 169 |
| 170 return container; | 170 return container; |
| 171 } | 171 } |
| 172 | 172 |
| 173 std::unique_ptr<views::ImageView> CreateCardIconView( | 173 std::unique_ptr<views::ImageView> CreateInstrumentIconView( |
| 174 const std::string& card_type) { | 174 int icon_resource_id, |
| 175 const base::string16& tooltip_text) { |
| 175 std::unique_ptr<views::ImageView> card_icon_view = | 176 std::unique_ptr<views::ImageView> card_icon_view = |
| 176 base::MakeUnique<views::ImageView>(); | 177 base::MakeUnique<views::ImageView>(); |
| 177 card_icon_view->set_can_process_events_within_subtree(false); | 178 card_icon_view->set_can_process_events_within_subtree(false); |
| 178 card_icon_view->SetImage( | 179 card_icon_view->SetImage(ResourceBundle::GetSharedInstance() |
| 179 ResourceBundle::GetSharedInstance() | 180 .GetImageNamed(icon_resource_id) |
| 180 .GetImageNamed(autofill::data_util::GetPaymentRequestData(card_type) | 181 .AsImageSkia()); |
| 181 .icon_resource_id) | 182 card_icon_view->SetTooltipText(tooltip_text); |
| 182 .AsImageSkia()); | |
| 183 card_icon_view->SetTooltipText( | |
| 184 autofill::CreditCard::TypeForDisplay(card_type)); | |
| 185 card_icon_view->SetBorder(views::CreateRoundedRectBorder( | 183 card_icon_view->SetBorder(views::CreateRoundedRectBorder( |
| 186 1, 3, card_icon_view->GetNativeTheme()->GetSystemColor( | 184 1, 3, card_icon_view->GetNativeTheme()->GetSystemColor( |
| 187 ui::NativeTheme::kColorId_UnfocusedBorderColor))); | 185 ui::NativeTheme::kColorId_UnfocusedBorderColor))); |
| 188 return card_icon_view; | 186 return card_icon_view; |
| 189 } | 187 } |
| 190 | 188 |
| 191 std::unique_ptr<views::View> GetShippingAddressLabel( | 189 std::unique_ptr<views::View> GetShippingAddressLabel( |
| 192 AddressStyleType type, | 190 AddressStyleType type, |
| 193 const std::string& locale, | 191 const std::string& locale, |
| 194 const autofill::AutofillProfile& profile) { | 192 const autofill::AutofillProfile& profile) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if (shipping_option) { | 289 if (shipping_option) { |
| 292 container->AddChildView( | 290 container->AddChildView( |
| 293 new views::Label(base::ASCIIToUTF16(shipping_option->label))); | 291 new views::Label(base::ASCIIToUTF16(shipping_option->label))); |
| 294 container->AddChildView(new views::Label(formatted_amount)); | 292 container->AddChildView(new views::Label(formatted_amount)); |
| 295 } | 293 } |
| 296 | 294 |
| 297 return container; | 295 return container; |
| 298 } | 296 } |
| 299 | 297 |
| 300 } // namespace payments | 298 } // namespace payments |
| OLD | NEW |