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

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

Issue 2841603004: [Payments] Update some editor titles to reflect missing information (Closed)
Patch Set: Initial Created 3 years, 8 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
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
278 IDS_PAYMENT_REQUEST_CREDIT_CARD_EDITOR_ADD_TITLE);
279
280 // Gets the completion message, or empty if nothing is missing from the card.
281 base::string16 title = autofill::GetCompletionMessageForCard(
282 autofill::GetCompletionStatusForCard(*credit_card_to_edit_,
283 state()->GetApplicationLocale()));
284 return title.empty() ? l10n_util::GetStringUTF16(IDS_PAYMENTS_EDIT_CARD)
285 : title;
278 } 286 }
279 287
280 CreditCardEditorViewController::CreditCardValidationDelegate:: 288 CreditCardEditorViewController::CreditCardValidationDelegate::
281 CreditCardValidationDelegate( 289 CreditCardValidationDelegate(
282 const EditorField& field, 290 const EditorField& field,
283 EditorViewController* controller, 291 EditorViewController* controller,
284 const std::vector<std::string>& supported_card_networks) 292 const std::vector<std::string>& supported_card_networks)
285 : field_(field), 293 : field_(field),
286 controller_(controller), 294 controller_(controller),
287 supported_card_networks_(supported_card_networks.begin(), 295 supported_card_networks_(supported_card_networks.begin(),
(...skipping 27 matching lines...) Expand all
315 bool is_required_valid = !field_.required; 323 bool is_required_valid = !field_.required;
316 const base::string16 displayed_message = 324 const base::string16 displayed_message =
317 is_required_valid ? base::ASCIIToUTF16("") 325 is_required_valid ? base::ASCIIToUTF16("")
318 : l10n_util::GetStringUTF16( 326 : l10n_util::GetStringUTF16(
319 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 327 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
320 controller_->DisplayErrorMessageForField(field_, displayed_message); 328 controller_->DisplayErrorMessageForField(field_, displayed_message);
321 return is_required_valid; 329 return is_required_valid;
322 } 330 }
323 331
324 } // namespace payments 332 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698