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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..61af19277016af87e2484a7a1edae28b6071cb76
--- /dev/null
+++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
+
+#include <utility>
+
+#include "base/strings/string16.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
+#include "chrome/grit/generated_resources.h"
+#include "components/autofill/core/browser/field_types.h"
+#include "components/payments/payment_request.h"
+#include "ui/base/l10n/l10n_util.h"
+
+namespace payments {
+
+CreditCardEditorViewController::CreditCardEditorViewController(
+ PaymentRequest* request,
+ PaymentRequestDialogView* dialog)
+ : EditorViewController(request, dialog) {}
+
+CreditCardEditorViewController::~CreditCardEditorViewController() {}
+
+std::vector<std::unique_ptr<EditorField>>
+CreditCardEditorViewController::GetFieldDefinitions() {
+ std::vector<std::unique_ptr<EditorField>> fields;
+ fields.push_back(base::MakeUnique<EditorField>(
+ autofill::CREDIT_CARD_NAME_FULL,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD),
+ EditorField::LengthHint::HINT_LONG));
+ fields.push_back(base::MakeUnique<EditorField>(
+ 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.
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_CREDIT_CARD_NUMBER),
+ EditorField::LengthHint::HINT_LONG));
+ 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
+ autofill::CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EXPIRATION_DATE),
+ EditorField::LengthHint::HINT_SHORT));
+ return fields;
+}
+
+bool CreditCardEditorViewController::ValidateModelAndSave() {
+ // TODO(mathp): Actual validation and saving the model on disk.
+ return true;
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698