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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp

Issue 2355463002: [PaymentReqeust] Add error message in PaymentDetails. (in blink side) (Closed)
Patch Set: rebase from origin Created 4 years, 3 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: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
index 5fe6dd2cd91e9b298c9c2da680fdb89e1cdb10fb..8d664b5a3c918cd89a341ef884f1330577ab34b1 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
@@ -9,12 +9,12 @@
namespace blink {
-// We limit the maximum length of the currency code to 2048 bytes for security reasons.
-static const int maxCurrencyCodeLength = 2048;
+// We limit the maximum length of string to 2048 bytes for security reasons.
+static const int maxiumStringLength = 2048;
bool PaymentsValidators::isValidCurrencyCodeFormat(const String& code, String* optionalErrorMessage)
{
- if (code.length() <= maxCurrencyCodeLength)
+ if (code.length() <= maxiumStringLength)
return true;
if (optionalErrorMessage)
@@ -88,4 +88,15 @@ bool PaymentsValidators::isValidShippingAddress(const mojom::blink::PaymentAddre
return true;
}
+bool PaymentsValidators::isValidErrorMsgFormat(const String& error, String* optionalErrorMessage)
+{
+ if (error.length() <= maxiumStringLength)
+ return true;
+
+ if (optionalErrorMessage)
+ *optionalErrorMessage = "Error message should be at most 2048 characters long";
+
+ return false;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698