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

Issue 2924513002: use user chosen country code to format and validate phone number for addresses. (Closed)

Created:
3 years, 6 months ago by wuandy1
Modified:
3 years, 6 months ago
Reviewers:
gogerald1
CC:
chromium-reviews, rouslan+payments_chromium.org, rouslan+autofill_chromium.org, rogerm+autofillwatch_chromium.org, sebsg+autofillwatch_chromium.org, browser-components-watch_chromium.org, gogerald+paymentswatch_chromium.org, mahmadi+paymentswatch_chromium.org, mathp+autofillwatch_chromium.org, agrieve+watch_chromium.org, vabr+watchlistautofill_chromium.org, estade+watch_chromium.org, sebsg+paymentswatch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

use user chosen country code to format and validate phone number for addresses. This change will use the country specified by user(as part of address) to format and validate phone numbers in PaymentRequest UI. Previously it was using application's locale. This should give user a better experience and eliminate cases where phone number is mistakenly formatted because application locale is not determined properly. For example, clank sees fr-CA as fr and formats Canadian numbers as french numbers. BUG=723769

Patch Set 1 #

Patch Set 2 : looks like most of it is working #

Patch Set 3 : add comments #

Total comments: 14

Patch Set 4 : comments addressing #

Total comments: 8

Patch Set 5 : more fixing #

Total comments: 23

Patch Set 6 : fix presubmit complaints #

Total comments: 16

Patch Set 7 : more fixing... #

Messages

Total messages: 46 (29 generated)
wuandy1
please take a look
3 years, 6 months ago (2017-06-07 02:55:19 UTC) #12
gogerald1
Please also update the CL description as I mentioned in your last CL https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java File ...
3 years, 6 months ago (2017-06-08 16:20:43 UTC) #16
wuandy1
https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java File chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java (right): https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java#newcode29 chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java:29: public void setCountryCode(String countryCode) { On 2017/06/08 16:20:43, gogerald1 ...
3 years, 6 months ago (2017-06-08 20:34:58 UTC) #18
gogerald1
https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java File chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java (right): https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java#newcode401 chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:401: value.toString(), mRecentlySelectedCountry); On 2017/06/08 20:34:58, wuandy1 wrote: > On ...
3 years, 6 months ago (2017-06-09 13:33:46 UTC) #19
wuandy1
https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java File chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java (right): https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java#newcode401 chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:401: value.toString(), mRecentlySelectedCountry); On 2017/06/09 13:33:46, gogerald1 wrote: > On ...
3 years, 6 months ago (2017-06-12 14:15:25 UTC) #20
gogerald1
https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java File chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java (right): https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java#newcode401 chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:401: value.toString(), mRecentlySelectedCountry); On 2017/06/12 14:15:25, wuandy1 wrote: > On ...
3 years, 6 months ago (2017-06-12 17:02:11 UTC) #21
wuandy1
https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java File chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java (right): https://codereview.chromium.org/2924513002/diff/40001/chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java#newcode401 chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:401: value.toString(), mRecentlySelectedCountry); On 2017/06/12 17:02:11, gogerald1 wrote: > On ...
3 years, 6 months ago (2017-06-13 19:47:26 UTC) #22
gogerald1
Added rouslan@ for more ideas, https://codereview.chromium.org/2924513002/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java File chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java (right): https://codereview.chromium.org/2924513002/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java#newcode65 chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java:65: public static String formatForDisplay(String ...
3 years, 6 months ago (2017-06-15 17:41:36 UTC) #28
please use gerrit instead
On 2017/06/15 17:41:36, gogerald1 wrote: > Added rouslan@ for more ideas, Is there a specific ...
3 years, 6 months ago (2017-06-15 17:42:43 UTC) #29
gogerald1
On 2017/06/15 17:42:43, rouslan wrote: > On 2017/06/15 17:41:36, gogerald1 wrote: > > Added rouslan@ ...
3 years, 6 months ago (2017-06-15 18:20:27 UTC) #30
please use gerrit instead
On 2017/06/15 18:20:27, gogerald1 wrote: > On 2017/06/15 17:42:43, rouslan wrote: > > On 2017/06/15 ...
3 years, 6 months ago (2017-06-15 18:26:01 UTC) #31
wuandy1
On 2017/06/15 18:26:01, rouslan wrote: > On 2017/06/15 18:20:27, gogerald1 wrote: > > On 2017/06/15 ...
3 years, 6 months ago (2017-06-19 14:23:18 UTC) #33
wuandy1
https://codereview.chromium.org/2924513002/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java File chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java (right): https://codereview.chromium.org/2924513002/diff/80001/chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java#newcode65 chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java:65: public static String formatForDisplay(String phoneNumber, String countryCode) { On ...
3 years, 6 months ago (2017-06-19 15:11:14 UTC) #34
gogerald1
Almost done, few more comments, BTW, I know you have more important things to take ...
3 years, 6 months ago (2017-06-19 21:30:39 UTC) #39
wuandy1
Addressed most of the comments except the refactor to move formatter off EditorDialog, i have ...
3 years, 6 months ago (2017-06-20 15:33:27 UTC) #40
gogerald1
On 2017/06/20 15:33:27, wuandy1 wrote: > Addressed most of the comments except the refactor to ...
3 years, 6 months ago (2017-06-21 14:40:48 UTC) #45
wuandy1
3 years, 6 months ago (2017-06-21 17:34:15 UTC) #46
Message was sent while issue was closed.
On 2017/06/21 14:40:48, gogerald1 wrote:
> On 2017/06/20 15:33:27, wuandy1 wrote:
> > Addressed most of the comments except the refactor to move formatter off
> > EditorDialog, i have limited time every day..if you can help pick that up it
> > would be great!!
> > 
> > Also, Mathieu mentioned he wanted this to be merge back to 60, can you check
> > with him and take care of that as well.
> > 
> > A million thanks!
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> > File
> >
>
chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java
> > (right):
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> >
>
chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java:57:
> > * [i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::INTERNATIONAL]
> based
> > on
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > Sorry, these comments still looks confusion and incomplete (sometimes
> comment
> > is
> > > harder than code), I would comment like below.
> > > 
> > > /**
> > >  * Formats the given phone number in INTERNATIONAL format
> > >  * [i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat::INTERNATIONAL]
> > based
> > >  * on region code, returning the original number if no formatting can be
> made.
> > >  * For example, the number of the Google Zürich office will be formatted
as 
> > >  * "+41 44 668 1800" in INTERNATIONAL format.
> > >  * 
> > >  * Note that the region code is from the given phone number if it starts
> with 
> > >  * '+', otherwise the region code is deduced from the given country code
or
> > >  * from application locale if the given country code is null.
> > >  *
> > >  * @param phoneNumber The given phone number.
> > >  * @param countryCode The given country code.
> > >  * @return Formatted phone number.
> > >  */
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> >
>
chrome/android/java/src/org/chromium/chrome/browser/autofill/PhoneNumberUtil.java:86:
> > * Checks whether the given phone number matches a valid pattern according to
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > Similarly, I would comment like below:
> > > 
> > > /**
> > >  * Checks whether the given phone number matches a valid pattern according
> to 
> > >  * region code.
> > >  * The region code is from the given phone number if it starts with '+', 
> > >  * otherwise the region code is deduced from the given country code or
from 
> > >  * application locale if the given country code is null.
> > >  *
> > >  * @param phoneNumber The given phone number.
> > >  * @param countryCode The given country code.
> > >  *
> > >  * @return True if the given number is valid, otherwise return false.
> > >  */
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> > File
> >
>
chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java
> > (right):
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> >
>
chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:62:
> > *                    We don't validate for number format since these are
> > suggestions only.
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > The reason we do not validate it here is not because they are used for
> > > suggestions only, but they are expected to have already been validated
since
> > we
> > > are doing strict Autofill data validation.
> > > 
> > > And here is not validating 'number format' but 'number validity'. I would
> > > comment like below:
> > > 
> > > /**
> > >  * Adds the given phone number to the autocomplete set, if it's valid.
> > >  * Note that here we consider all non-null and non-empty numbers as valid 
> > >  * since we are doing strict validation of Autofill data.
> > >  *
> > >  * @param phoneNumber The phone number to possibly add.
> > >  */
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> >
>
chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:65:
> > if (phoneNumber != null && !phoneNumber.toString().isEmpty()) {
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > use TextUtils.isEmpty() which do both,
> > >
> >
>
https://cs.chromium.org/chromium/src/third_party/android_tools/sdk/sources/an...
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/android/java/sr...
> >
>
chrome/android/java/src/org/chromium/chrome/browser/payments/AddressEditor.java:399:
> > @Nullable final EditorFieldModel countryCodeField) {
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > Why are you using EditorFieldModel instead of country code directly? Why
it
> is
> > > Nullable?
> > 
> > because validator can then run validation after user changed the value. it
> > should not be @nullable though.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/browser/autofil...
> > File chrome/browser/autofill/android/phone_number_util_android.cc (right):
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/browser/autofil...
> > chrome/browser/autofill/android/phone_number_util_android.cc:24: // Formats
> the
> > |phone_number| to the specified |format| based on a given
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > *for the given country |countryCode| *
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/browser/autofil...
> > chrome/browser/autofill/android/phone_number_util_android.cc:70: // Formats
> the
> > given number |jphone_number| for a given country to
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > *for the given country |jcountry_code| *
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/2924513002/diff/100001/chrome/browser/autofil...
> > chrome/browser/autofill/android/phone_number_util_android.cc:104: // Checks
> > whether the given number |jphone_number| is valid for a given country
> > On 2017/06/19 21:30:38, gogerald1 wrote:
> > > *for the given country |jcountry_code| *
> > 
> > Done.
> 
> The corresponding CL https://codereview.chromium.org/2952673002/ has been
> landed, you can close this one now.

thanks.

Powered by Google App Engine
This is Rietveld 408576698