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

Unified Diff: components/payments/content/payment_request_state.cc

Issue 2766353004: [Payments] Support canMakePayment on Desktop (Closed)
Patch Set: only support valid instruments, added test Created 3 years, 9 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: components/payments/content/payment_request_state.cc
diff --git a/components/payments/content/payment_request_state.cc b/components/payments/content/payment_request_state.cc
index 26e8bf3d5f951169ceec6af0171c6db8a08d4eee..f727b09e80f77e3445789fb1da7b51048cb383db 100644
--- a/components/payments/content/payment_request_state.cc
+++ b/components/payments/content/payment_request_state.cc
@@ -34,6 +34,19 @@ PaymentRequestState::PaymentRequestState(
SetDefaultProfileSelections();
}
+bool PaymentRequestState::CanMakePayment() const {
+ // TODO(crbug.com/704675): Handle incognito mode when replying to this method.
+ for (const std::unique_ptr<PaymentInstrument>& instrument :
+ available_instruments_) {
+ if (instrument.get()->IsValid() &&
+ spec_->supported_card_networks_set().count(
+ instrument.get()->method_name())) {
+ return true;
+ }
+ }
+ return false;
+}
+
void PaymentRequestState::AddObserver(Observer* observer) {
CHECK(observer);
observers_.AddObserver(observer);
« no previous file with comments | « components/payments/content/payment_request_state.h ('k') | components/payments/content/payment_request_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698