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

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

Issue 2774233005: Creating PaymentOptionsProvider interface (Closed)
Patch Set: rouslan comments 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
« no previous file with comments | « components/payments/content/payment_request_spec.h ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/content/payment_request_spec.cc
diff --git a/components/payments/content/payment_request_spec.cc b/components/payments/content/payment_request_spec.cc
index 3435871ce3ef0be458e24359ecee492fea3facf6..bcc98b441bded800d4de21d2e054274536f98189 100644
--- a/components/payments/content/payment_request_spec.cc
+++ b/components/payments/content/payment_request_spec.cc
@@ -36,6 +36,35 @@ void PaymentRequestSpec::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
+bool PaymentRequestSpec::request_shipping() const {
+ return options_->request_shipping;
+}
+bool PaymentRequestSpec::request_payer_name() const {
+ return options_->request_payer_name;
+}
+bool PaymentRequestSpec::request_payer_phone() const {
+ return options_->request_payer_phone;
+}
+bool PaymentRequestSpec::request_payer_email() const {
+ return options_->request_payer_email;
+}
+
+PaymentShippingType PaymentRequestSpec::shipping_type() const {
+ // Transform Mojo-specific enum into platform-agnostic equivalent.
+ switch (options_->shipping_type) {
+ case mojom::PaymentShippingType::DELIVERY:
+ return PaymentShippingType::DELIVERY;
+ case payments::mojom::PaymentShippingType::PICKUP:
+ return PaymentShippingType::PICKUP;
+ case payments::mojom::PaymentShippingType::SHIPPING:
+ return PaymentShippingType::SHIPPING;
+ default:
+ NOTREACHED();
+ }
+ // Needed for compilation on some platforms.
+ return PaymentShippingType::SHIPPING;
+}
+
bool PaymentRequestSpec::IsMethodSupportedThroughBasicCard(
const std::string& method_name) {
return basic_card_specified_networks_.count(method_name) > 0;
« no previous file with comments | « components/payments/content/payment_request_spec.h ('k') | components/payments/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698