| 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/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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 126   constexpr int kPaddingBetweenCardIcons = 8; | 126   constexpr int kPaddingBetweenCardIcons = 8; | 
| 127   std::unique_ptr<views::View> icons_row = base::MakeUnique<views::View>(); | 127   std::unique_ptr<views::View> icons_row = base::MakeUnique<views::View>(); | 
| 128   views::BoxLayout* icons_layout = new views::BoxLayout( | 128   views::BoxLayout* icons_layout = new views::BoxLayout( | 
| 129       views::BoxLayout::kHorizontal, 0, 0, kPaddingBetweenCardIcons); | 129       views::BoxLayout::kHorizontal, 0, 0, kPaddingBetweenCardIcons); | 
| 130   icons_row->SetLayoutManager(icons_layout); | 130   icons_row->SetLayoutManager(icons_layout); | 
| 131 | 131 | 
| 132   constexpr gfx::Size kCardIconSize = gfx::Size(30, 18); | 132   constexpr gfx::Size kCardIconSize = gfx::Size(30, 18); | 
| 133   for (const std::string& supported_network : | 133   for (const std::string& supported_network : | 
| 134        spec()->supported_card_networks()) { | 134        spec()->supported_card_networks()) { | 
| 135     const std::string autofill_card_type = | 135     const std::string autofill_card_type = | 
| 136         autofill::data_util::GetCardTypeForBasicCardPaymentType( | 136         autofill::data_util::GetIssuerNetworkForBasicCardIssuerNetwork( | 
| 137             supported_network); | 137             supported_network); | 
| 138     std::unique_ptr<views::ImageView> card_icon_view = CreateInstrumentIconView( | 138     std::unique_ptr<views::ImageView> card_icon_view = CreateInstrumentIconView( | 
| 139         autofill::data_util::GetPaymentRequestData(autofill_card_type) | 139         autofill::data_util::GetPaymentRequestData(autofill_card_type) | 
| 140             .icon_resource_id, | 140             .icon_resource_id, | 
| 141         base::UTF8ToUTF16(supported_network)); | 141         base::UTF8ToUTF16(supported_network)); | 
| 142     card_icon_view->SetImageSize(kCardIconSize); | 142     card_icon_view->SetImageSize(kCardIconSize); | 
| 143 | 143 | 
| 144     icons_row->AddChildView(card_icon_view.release()); | 144     icons_row->AddChildView(card_icon_view.release()); | 
| 145   } | 145   } | 
| 146   view->AddChildView(icons_row.release()); | 146   view->AddChildView(icons_row.release()); | 
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 322   bool is_required_valid = !field_.required; | 322   bool is_required_valid = !field_.required; | 
| 323   const base::string16 displayed_message = | 323   const base::string16 displayed_message = | 
| 324       is_required_valid ? base::ASCIIToUTF16("") | 324       is_required_valid ? base::ASCIIToUTF16("") | 
| 325                         : l10n_util::GetStringUTF16( | 325                         : l10n_util::GetStringUTF16( | 
| 326                               IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); | 326                               IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); | 
| 327   controller_->DisplayErrorMessageForField(field_, displayed_message); | 327   controller_->DisplayErrorMessageForField(field_, displayed_message); | 
| 328   return is_required_valid; | 328   return is_required_valid; | 
| 329 } | 329 } | 
| 330 | 330 | 
| 331 }  // namespace payments | 331 }  // namespace payments | 
| OLD | NEW | 
|---|