| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PaymentsValidators_h | 5 #ifndef PaymentsValidators_h |
| 6 #define PaymentsValidators_h | 6 #define PaymentsValidators_h |
| 7 | 7 |
| 8 #include "components/payments/payment_request.mojom-blink.h" | 8 #include "components/payments/payment_request.mojom-blink.h" |
| 9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // Returns true if |code| is a valid ISO 15924 script code. | 43 // Returns true if |code| is a valid ISO 15924 script code. |
| 44 static bool isValidScriptCodeFormat(const String& code, | 44 static bool isValidScriptCodeFormat(const String& code, |
| 45 String* optionalErrorMessage); | 45 String* optionalErrorMessage); |
| 46 | 46 |
| 47 // Returns true if the payment address is valid: | 47 // Returns true if the payment address is valid: |
| 48 // - Has a valid region code | 48 // - Has a valid region code |
| 49 // - Has a valid language code, if any. | 49 // - Has a valid language code, if any. |
| 50 // - Has a valid script code, if any. | 50 // - Has a valid script code, if any. |
| 51 // A script code should be present only if language code is present. | 51 // A script code should be present only if language code is present. |
| 52 static bool isValidShippingAddress(const mojom::blink::PaymentAddressPtr&, | 52 static bool isValidShippingAddress( |
| 53 String* optionalErrorMessage); | 53 const payments::mojom::blink::PaymentAddressPtr&, |
| 54 String* optionalErrorMessage); |
| 54 | 55 |
| 55 // Returns false if |error| is too long (greater than 2048). | 56 // Returns false if |error| is too long (greater than 2048). |
| 56 static bool isValidErrorMsgFormat(const String& code, | 57 static bool isValidErrorMsgFormat(const String& code, |
| 57 String* optionalErrorMessage); | 58 String* optionalErrorMessage); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 } // namespace blink | 61 } // namespace blink |
| 61 | 62 |
| 62 #endif // PaymentsValidators_h | 63 #endif // PaymentsValidators_h |
| OLD | NEW |