Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc

Issue 2757523002: [Payments] Use PaymentInstrument/AutofillPaymentInstrument throughout. (Closed)
Patch Set: addressed nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/payment_method_view_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/credit_card_editor_view_controller.h" 5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 views::BoxLayout* icons_layout = new views::BoxLayout( 122 views::BoxLayout* icons_layout = new views::BoxLayout(
123 views::BoxLayout::kHorizontal, 0, 0, kPaddingBetweenCardIcons); 123 views::BoxLayout::kHorizontal, 0, 0, kPaddingBetweenCardIcons);
124 icons_row->SetLayoutManager(icons_layout); 124 icons_row->SetLayoutManager(icons_layout);
125 125
126 constexpr gfx::Size kCardIconSize = gfx::Size(30, 18); 126 constexpr gfx::Size kCardIconSize = gfx::Size(30, 18);
127 for (const std::string& supported_network : 127 for (const std::string& supported_network :
128 spec()->supported_card_networks()) { 128 spec()->supported_card_networks()) {
129 const std::string autofill_card_type = 129 const std::string autofill_card_type =
130 autofill::data_util::GetCardTypeForBasicCardPaymentType( 130 autofill::data_util::GetCardTypeForBasicCardPaymentType(
131 supported_network); 131 supported_network);
132 std::unique_ptr<views::ImageView> card_icon_view = 132 std::unique_ptr<views::ImageView> card_icon_view = CreateInstrumentIconView(
133 CreateCardIconView(autofill_card_type); 133 autofill::data_util::GetPaymentRequestData(autofill_card_type)
134 .icon_resource_id,
135 base::UTF8ToUTF16(supported_network));
134 card_icon_view->SetImageSize(kCardIconSize); 136 card_icon_view->SetImageSize(kCardIconSize);
135 137
136 icons_row->AddChildView(card_icon_view.release()); 138 icons_row->AddChildView(card_icon_view.release());
137 } 139 }
138 view->AddChildView(icons_row.release()); 140 view->AddChildView(icons_row.release());
139 141
140 return view; 142 return view;
141 } 143 }
142 144
143 int CreditCardEditorViewController::GetViewHeaderTitleId() const { 145 int CreditCardEditorViewController::GetViewHeaderTitleId() const {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 bool is_required_valid = !field_.required; 270 bool is_required_valid = !field_.required;
269 const base::string16 displayed_message = 271 const base::string16 displayed_message =
270 is_required_valid ? base::ASCIIToUTF16("") 272 is_required_valid ? base::ASCIIToUTF16("")
271 : l10n_util::GetStringUTF16( 273 : l10n_util::GetStringUTF16(
272 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 274 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
273 controller_->DisplayErrorMessageForField(field_, displayed_message); 275 controller_->DisplayErrorMessageForField(field_, displayed_message);
274 return is_required_valid; 276 return is_required_valid;
275 } 277 }
276 278
277 } // namespace payments 279 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/payment_method_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698