| 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 #include "modules/payments/PaymentsValidators.h" | 5 #include "modules/payments/PaymentsValidators.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptRegexp.h" | 7 #include "bindings/core/v8/ScriptRegexp.h" |
| 8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
| 9 #include "wtf/text/StringImpl.h" | 9 #include "wtf/text/StringImpl.h" |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (optionalErrorMessage) | 94 if (optionalErrorMessage) |
| 95 *optionalErrorMessage = "'" + code + | 95 *optionalErrorMessage = "'" + code + |
| 96 "' is not a valid ISO 15924 script code, should be " | 96 "' is not a valid ISO 15924 script code, should be " |
| 97 "an upper case letter [A-Z] followed by 3 lower " | 97 "an upper case letter [A-Z] followed by 3 lower " |
| 98 "case letters [a-z]"; | 98 "case letters [a-z]"; |
| 99 | 99 |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool PaymentsValidators::isValidShippingAddress( | 103 bool PaymentsValidators::isValidShippingAddress( |
| 104 const payments::mojom::blink::PaymentAddressPtr& address, | 104 const mojom::blink::PaymentAddressPtr& address, |
| 105 String* optionalErrorMessage) { | 105 String* optionalErrorMessage) { |
| 106 if (!isValidCountryCodeFormat(address->country, optionalErrorMessage)) | 106 if (!isValidCountryCodeFormat(address->country, optionalErrorMessage)) |
| 107 return false; | 107 return false; |
| 108 | 108 |
| 109 if (!isValidLanguageCodeFormat(address->language_code, optionalErrorMessage)) | 109 if (!isValidLanguageCodeFormat(address->language_code, optionalErrorMessage)) |
| 110 return false; | 110 return false; |
| 111 | 111 |
| 112 if (!isValidScriptCodeFormat(address->script_code, optionalErrorMessage)) | 112 if (!isValidScriptCodeFormat(address->script_code, optionalErrorMessage)) |
| 113 return false; | 113 return false; |
| 114 | 114 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 129 return true; | 129 return true; |
| 130 | 130 |
| 131 if (optionalErrorMessage) | 131 if (optionalErrorMessage) |
| 132 *optionalErrorMessage = | 132 *optionalErrorMessage = |
| 133 "Error message should be at most 2048 characters long"; | 133 "Error message should be at most 2048 characters long"; |
| 134 | 134 |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace blink | 138 } // namespace blink |
| OLD | NEW |