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

Unified Diff: chrome/browser/ui/views/payments/payment_method_view_controller.cc

Issue 2805263003: [Payments] Selecting incomplete items will open editors (Closed)
Patch Set: fix ios test for realz 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_method_view_controller.cc
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller.cc b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
index 1bdb8dcdc563f8fc868726f4afedb82861ca0fcf..799fe3e277b5a3746d3fdffd7a8affbb4250cd9c 100644
--- a/chrome/browser/ui/views/payments/payment_method_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ui/views/payments/payment_request_views_util.h"
#include "chrome/grit/generated_resources.h"
#include "components/payments/content/payment_request_state.h"
+#include "components/payments/core/autofill_payment_instrument.h"
#include "components/payments/core/payment_instrument.h"
#include "components/strings/grit/components_strings.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -94,12 +95,20 @@ class PaymentMethodListItem : public payments::PaymentRequestItemList::Item {
}
bool CanBeSelected() const override {
- // TODO(anthonyvd): Check for card completedness.
- return true;
+ // If an instrument can't be selected, PerformSelectionFallback is called,
+ // where the instrument can be made complete.
+ return instrument_->IsCompleteForPayment();
}
void PerformSelectionFallback() override {
- // TODO(anthonyvd): Open the editor pre-populated with this card's data.
+ switch (instrument_->type()) {
+ case PaymentInstrument::Type::AUTOFILL:
+ dialog_->ShowCreditCardEditor(
+ static_cast<AutofillPaymentInstrument*>(instrument_)
+ ->credit_card());
+ return;
+ }
+ NOTREACHED();
}
PaymentInstrument* instrument_;

Powered by Google App Engine
This is Rietveld 408576698