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

Side by Side Diff: components/payments/payments_validators.cc

Issue 2477883002: [Web Payments] Mojom namespace blink -> payments (Closed)
Patch Set: Fix WebKit tests Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 "components/payments/payments_validators.h" 5 #include "components/payments/payments_validators.h"
6 6
7 #include "third_party/re2/src/re2/re2.h" 7 #include "third_party/re2/src/re2/re2.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 9
10 namespace payments { 10 namespace payments {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (optionalErrorMessage) 92 if (optionalErrorMessage)
93 *optionalErrorMessage = "'" + code + 93 *optionalErrorMessage = "'" + code +
94 "' is not a valid ISO 15924 script code, should be " 94 "' is not a valid ISO 15924 script code, should be "
95 "an upper case letter [A-Z] followed by 3 lower " 95 "an upper case letter [A-Z] followed by 3 lower "
96 "case letters [a-z]"; 96 "case letters [a-z]";
97 97
98 return false; 98 return false;
99 } 99 }
100 100
101 bool PaymentsValidators::isValidShippingAddress( 101 bool PaymentsValidators::isValidShippingAddress(
102 const blink::mojom::PaymentAddressPtr& address, 102 const mojom::PaymentAddressPtr& address,
103 std::string* optionalErrorMessage) { 103 std::string* optionalErrorMessage) {
104 if (!isValidCountryCodeFormat(address->country, optionalErrorMessage)) 104 if (!isValidCountryCodeFormat(address->country, optionalErrorMessage))
105 return false; 105 return false;
106 106
107 if (!isValidLanguageCodeFormat(address->language_code, optionalErrorMessage)) 107 if (!isValidLanguageCodeFormat(address->language_code, optionalErrorMessage))
108 return false; 108 return false;
109 109
110 if (!isValidScriptCodeFormat(address->script_code, optionalErrorMessage)) 110 if (!isValidScriptCodeFormat(address->script_code, optionalErrorMessage))
111 return false; 111 return false;
112 112
(...skipping 15 matching lines...) Expand all
128 return true; 128 return true;
129 129
130 if (optionalErrorMessage) 130 if (optionalErrorMessage)
131 *optionalErrorMessage = 131 *optionalErrorMessage =
132 "Error message should be at most 2048 characters long"; 132 "Error message should be at most 2048 characters long";
133 133
134 return false; 134 return false;
135 } 135 }
136 136
137 } // namespace payments 137 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/payments_validators.h ('k') | components/payments/payments_validators_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698