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

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

Issue 2676663002: [Payments] Implements the credit card editor for Desktop UI (Closed)
Patch Set: Initial Created 3 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
6
7 #include <utility>
8
9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
12 #include "chrome/grit/generated_resources.h"
13 #include "components/autofill/core/browser/field_types.h"
14 #include "components/payments/payment_request.h"
15 #include "ui/base/l10n/l10n_util.h"
16
17 namespace payments {
18
19 CreditCardEditorViewController::CreditCardEditorViewController(
20 PaymentRequest* request,
21 PaymentRequestDialogView* dialog)
22 : EditorViewController(request, dialog) {}
23
24 CreditCardEditorViewController::~CreditCardEditorViewController() {}
25
26 std::vector<std::unique_ptr<EditorField>>
27 CreditCardEditorViewController::GetFieldDefinitions() {
28 std::vector<std::unique_ptr<EditorField>> fields;
29 fields.push_back(base::MakeUnique<EditorField>(
30 autofill::CREDIT_CARD_NAME_FULL,
31 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD),
32 EditorField::LengthHint::HINT_LONG));
33 fields.push_back(base::MakeUnique<EditorField>(
34 autofill::CREDIT_CARD_NUMBER,
please use gerrit instead 2017/02/02 20:19:02 Android puts number first, by the way.
Mathieu 2017/02/03 02:18:57 Done.
35 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER),
36 EditorField::LengthHint::HINT_LONG));
37 fields.push_back(base::MakeUnique<EditorField>(
please use gerrit instead 2017/02/02 20:19:02 Adding the exp-month field in a follow up patch?
Mathieu 2017/02/03 02:18:57 Not meant to be functional just yet, but for now i
38 autofill::CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR,
39 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_DATE),
40 EditorField::LengthHint::HINT_SHORT));
41 return fields;
42 }
43
44 bool CreditCardEditorViewController::ValidateModelAndSave() {
45 // TODO(mathp): Actual validation and saving the model on disk.
46 return true;
47 }
48
49 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698