Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/core/payments_profile_comparator.h" | 5 #include "components/payments/core/payments_profile_comparator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 // Determine the country code to use when validating the phone number. Use | 200 // Determine the country code to use when validating the phone number. Use |
| 201 // the profile's country if it has one, or the code for the app locale | 201 // the profile's country if it has one, or the code for the app locale |
| 202 // otherwise. Note that international format numbers will always work--this | 202 // otherwise. Note that international format numbers will always work--this |
| 203 // is just the region that will be used to check if the number is | 203 // is just the region that will be used to check if the number is |
| 204 // potentially in a local format. | 204 // potentially in a local format. |
| 205 std::string country = | 205 std::string country = |
| 206 data_util::GetCountryCodeWithFallback(&profile, app_locale()); | 206 data_util::GetCountryCodeWithFallback(&profile, app_locale()); |
| 207 | 207 |
| 208 base::string16 phone = profile.GetInfo( | 208 base::string16 phone = profile.GetInfo( |
| 209 autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), app_locale()); | 209 autofill::AutofillType(autofill::PHONE_HOME_WHOLE_NUMBER), app_locale()); |
| 210 if (!autofill::IsValidPhoneNumber(phone, country)) | 210 base::string16 intl_phone = base::UTF8ToUTF16("+" + base::UTF16ToUTF8(phone)); |
| 211 if (!(autofill::IsValidPhoneNumber(phone, country) || | |
|
tmartino
2017/05/30 21:52:57
We should keep this consistent with what we do in
sebsg
2017/05/31 14:20:35
Yep, it should already be the case. I modified the
tmartino
2017/05/31 14:48:14
So basically are you saying the + is always passed
sebsg
2017/05/31 17:50:25
Not necessarily. Here is the distinction
When we
| |
| 212 autofill::IsValidPhoneNumber(intl_phone, country))) | |
| 211 missing |= kPhone; | 213 missing |= kPhone; |
| 212 | 214 |
| 213 base::string16 email = profile.GetInfo( | 215 base::string16 email = profile.GetInfo( |
| 214 autofill::AutofillType(autofill::EMAIL_ADDRESS), app_locale()); | 216 autofill::AutofillType(autofill::EMAIL_ADDRESS), app_locale()); |
| 215 if (!autofill::IsValidEmailAddress(email)) | 217 if (!autofill::IsValidEmailAddress(email)) |
| 216 missing |= kEmail; | 218 missing |= kEmail; |
| 217 | 219 |
| 218 if (!AreRequiredAddressFieldsPresent(profile)) | 220 if (!AreRequiredAddressFieldsPresent(profile)) |
| 219 missing |= kAddress; | 221 missing |= kAddress; |
| 220 | 222 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 return GetContactCompletenessScore(p1) > GetContactCompletenessScore(p2); | 277 return GetContactCompletenessScore(p1) > GetContactCompletenessScore(p2); |
| 276 } | 278 } |
| 277 | 279 |
| 278 bool PaymentsProfileComparator::IsShippingMoreComplete( | 280 bool PaymentsProfileComparator::IsShippingMoreComplete( |
| 279 const autofill::AutofillProfile* p1, | 281 const autofill::AutofillProfile* p1, |
| 280 const autofill::AutofillProfile* p2) const { | 282 const autofill::AutofillProfile* p2) const { |
| 281 return GetShippingCompletenessScore(p1) > GetShippingCompletenessScore(p2); | 283 return GetShippingCompletenessScore(p1) > GetShippingCompletenessScore(p2); |
| 282 } | 284 } |
| 283 | 285 |
| 284 } // namespace payments | 286 } // namespace payments |
| OLD | NEW |