| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 return std::unique_ptr<ui::ComboboxModel>( | 266 return std::unique_ptr<ui::ComboboxModel>( |
| 267 new ui::SimpleComboboxModel(GetExpirationYearItems())); | 267 new ui::SimpleComboboxModel(GetExpirationYearItems())); |
| 268 default: | 268 default: |
| 269 NOTREACHED(); | 269 NOTREACHED(); |
| 270 break; | 270 break; |
| 271 } | 271 } |
| 272 return std::unique_ptr<ui::ComboboxModel>(); | 272 return std::unique_ptr<ui::ComboboxModel>(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 base::string16 CreditCardEditorViewController::GetSheetTitle() { | 275 base::string16 CreditCardEditorViewController::GetSheetTitle() { |
| 276 return l10n_util::GetStringUTF16( | 276 if (!credit_card_to_edit_) |
| 277 IDS_PAYMENT_REQUEST_CREDIT_CARD_EDITOR_ADD_TITLE); | 277 return l10n_util::GetStringUTF16(IDS_PAYMENTS_ADD_CARD); |
| 278 |
| 279 // Gets the completion message, or empty if nothing is missing from the card. |
| 280 base::string16 title = autofill::GetCompletionMessageForCard( |
| 281 autofill::GetCompletionStatusForCard(*credit_card_to_edit_, |
| 282 state()->GetApplicationLocale())); |
| 283 return title.empty() ? l10n_util::GetStringUTF16(IDS_PAYMENTS_EDIT_CARD) |
| 284 : title; |
| 278 } | 285 } |
| 279 | 286 |
| 280 CreditCardEditorViewController::CreditCardValidationDelegate:: | 287 CreditCardEditorViewController::CreditCardValidationDelegate:: |
| 281 CreditCardValidationDelegate( | 288 CreditCardValidationDelegate( |
| 282 const EditorField& field, | 289 const EditorField& field, |
| 283 EditorViewController* controller, | 290 EditorViewController* controller, |
| 284 const std::vector<std::string>& supported_card_networks) | 291 const std::vector<std::string>& supported_card_networks) |
| 285 : field_(field), | 292 : field_(field), |
| 286 controller_(controller), | 293 controller_(controller), |
| 287 supported_card_networks_(supported_card_networks.begin(), | 294 supported_card_networks_(supported_card_networks.begin(), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 315 bool is_required_valid = !field_.required; | 322 bool is_required_valid = !field_.required; |
| 316 const base::string16 displayed_message = | 323 const base::string16 displayed_message = |
| 317 is_required_valid ? base::ASCIIToUTF16("") | 324 is_required_valid ? base::ASCIIToUTF16("") |
| 318 : l10n_util::GetStringUTF16( | 325 : l10n_util::GetStringUTF16( |
| 319 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); | 326 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); |
| 320 controller_->DisplayErrorMessageForField(field_, displayed_message); | 327 controller_->DisplayErrorMessageForField(field_, displayed_message); |
| 321 return is_required_valid; | 328 return is_required_valid; |
| 322 } | 329 } |
| 323 | 330 |
| 324 } // namespace payments | 331 } // namespace payments |
| OLD | NEW |