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

Unified Diff: ios/web/payments/payment_request.cc

Issue 2797633002: [Payments] Move PaymentMethodData to components/payments/core (Closed)
Patch Set: clean 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
« no previous file with comments | « ios/chrome/browser/payments/payment_request_util.mm ('k') | ios/web/payments/payment_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/payments/payment_request.cc
diff --git a/ios/web/payments/payment_request.cc b/ios/web/payments/payment_request.cc
index b53b5edf813640944805d87a423f054fda2938c9..4d059b854f7dabfccc8297a207c5ec437528be83 100644
--- a/ios/web/payments/payment_request.cc
+++ b/ios/web/payments/payment_request.cc
@@ -12,7 +12,6 @@ namespace {
// All of these are defined here (even though most are only used once each) so
// the format details are easy to locate and update or compare to the spec doc.
// (https://w3c.github.io/browser-payment-api/).
-static const char kMethodDataData[] = "data";
static const char kPaymentCurrencyAmountCurrencySystemISO4217[] =
"urn:iso:std:iso:4217";
static const char kPaymentCurrencyAmountCurrencySystem[] = "currencySystem";
@@ -47,49 +46,11 @@ static const char kPaymentShippingOptionAmount[] = "amount";
static const char kPaymentShippingOptionId[] = "id";
static const char kPaymentShippingOptionLabel[] = "label";
static const char kPaymentShippingOptionSelected[] = "selected";
-static const char kSupportedMethods[] = "supportedMethods";
} // namespace
namespace web {
-PaymentMethodData::PaymentMethodData() {}
-PaymentMethodData::PaymentMethodData(const PaymentMethodData& other) = default;
-PaymentMethodData::~PaymentMethodData() = default;
-
-bool PaymentMethodData::operator==(const PaymentMethodData& other) const {
- return this->supported_methods == other.supported_methods &&
- this->data == other.data;
-}
-
-bool PaymentMethodData::operator!=(const PaymentMethodData& other) const {
- return !(*this == other);
-}
-
-bool PaymentMethodData::FromDictionaryValue(
- const base::DictionaryValue& value) {
- this->supported_methods.clear();
-
- const base::ListValue* supported_methods_list = nullptr;
- // At least one supported method is required.
- if (!value.GetList(kSupportedMethods, &supported_methods_list) ||
- supported_methods_list->GetSize() == 0) {
- return false;
- }
- for (size_t i = 0; i < supported_methods_list->GetSize(); ++i) {
- base::string16 supported_method;
- if (!supported_methods_list->GetString(i, &supported_method)) {
- return false;
- }
- this->supported_methods.push_back(supported_method);
- }
-
- // Data is optional.
- value.GetString(kMethodDataData, &this->data);
-
- return true;
-}
-
PaymentCurrencyAmount::PaymentCurrencyAmount()
// By default, the currency is defined by [ISO4217]. For example, USD for
// US Dollars.
@@ -353,7 +314,7 @@ bool PaymentRequest::FromDictionaryValue(const base::DictionaryValue& value) {
if (!method_data_list->GetDictionary(i, &method_data_dict))
return false;
- PaymentMethodData method_data;
+ payments::PaymentMethodData method_data;
if (!method_data.FromDictionaryValue(*method_data_dict))
return false;
this->method_data.push_back(method_data);
« no previous file with comments | « ios/chrome/browser/payments/payment_request_util.mm ('k') | ios/web/payments/payment_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698