[Autofill Assistant] Replace label generation [chromium/src : main]

1 view
Skip to first unread message

Sandro Maggi (Gerrit)

unread,
Feb 22, 2022, 7:21:54 AM2/22/22
to autofill_ass...@google.com, Florian Gauger, Luca Hunkeler, chromium...@chromium.org

Attention is currently required from: Florian Gauger, Luca Hunkeler.

Patch set 2:Commit-Queue +1

View Change

1 comment:

To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
Gerrit-Change-Number: 3480016
Gerrit-PatchSet: 2
Gerrit-Owner: Sandro Maggi <sandr...@google.com>
Gerrit-Reviewer: Florian Gauger <f...@google.com>
Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
Gerrit-Attention: Florian Gauger <f...@google.com>
Gerrit-Attention: Luca Hunkeler <hl...@google.com>
Gerrit-Comment-Date: Tue, 22 Feb 2022 12:21:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Sandro Maggi (Gerrit)

unread,
Feb 22, 2022, 7:21:59 AM2/22/22
to autofill_ass...@google.com, Florian Gauger, Luca Hunkeler, chromium...@chromium.org

Attention is currently required from: Florian Gauger, Luca Hunkeler.

View Change

1 comment:

To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
Gerrit-Change-Number: 3480016
Gerrit-PatchSet: 2
Gerrit-Owner: Sandro Maggi <sandr...@google.com>
Gerrit-Reviewer: Florian Gauger <f...@google.com>
Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
Gerrit-Attention: Florian Gauger <f...@google.com>
Gerrit-Attention: Luca Hunkeler <hl...@google.com>
Gerrit-Comment-Date: Tue, 22 Feb 2022 12:21:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Luca Hunkeler (Gerrit)

unread,
Feb 23, 2022, 3:57:22 AM2/23/22
to Sandro Maggi, autofill_ass...@google.com, Chromium LUCI CQ, Florian Gauger, chromium...@chromium.org

Attention is currently required from: Florian Gauger, Sandro Maggi.

Patch set 2:Code-Review +1

View Change

1 comment:

To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
Gerrit-Change-Number: 3480016
Gerrit-PatchSet: 2
Gerrit-Owner: Sandro Maggi <sandr...@google.com>
Gerrit-Reviewer: Florian Gauger <f...@google.com>
Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
Gerrit-Attention: Florian Gauger <f...@google.com>
Gerrit-Attention: Sandro Maggi <sandr...@google.com>
Gerrit-Comment-Date: Wed, 23 Feb 2022 08:57:03 +0000

Florian Gauger (Gerrit)

unread,
Feb 23, 2022, 4:29:32 AM2/23/22
to Sandro Maggi, autofill_ass...@google.com, Luca Hunkeler, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Sandro Maggi.

View Change

6 comments:

  • Patchset:

  • File chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java:

    • Patch Set #2, Line 1144:

      PersonalDataManager.getInstance()
      .getShippingAddressLabelWithCountryForPaymentRequest(profile)

      nit: use variable instead of inline comment please - same below

  • File chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAddressEditorAutofill.java:

    • Patch Set #2, Line 54:

      PersonalDataManager.getInstance()
      .getShippingAddressLabelWithCountryForPaymentRequest(
      editedAddress.getProfile())

      nit: dito and below

  • File chrome/browser/android/autofill_assistant/ui_controller_android.cc:

To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
Gerrit-Change-Number: 3480016
Gerrit-PatchSet: 2
Gerrit-Owner: Sandro Maggi <sandr...@google.com>
Gerrit-Reviewer: Florian Gauger <f...@google.com>
Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
Gerrit-Attention: Sandro Maggi <sandr...@google.com>
Gerrit-Comment-Date: Wed, 23 Feb 2022 09:29:17 +0000

Sandro Maggi (Gerrit)

unread,
Feb 23, 2022, 4:44:21 AM2/23/22
to autofill_ass...@google.com, Luca Hunkeler, Chromium LUCI CQ, Florian Gauger, chromium...@chromium.org

Attention is currently required from: Florian Gauger.

View Change

6 comments:

  • Patchset:

  • File chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java:

    • Patch Set #2, Line 1144:

      PersonalDataManager.getInstance()
      .getShippingAddressLabelWithCountryForPaymentRequest(profile)

      nit: use variable instead of inline comment please - same below

    • Done

  • File chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAddressEditorAutofill.java:

    • Patch Set #2, Line 54:

      PersonalDataManager.getInstance()
      .getShippingAddressLabelWithCountryForPaymentRequest(
      editedAddress.getProfile())

      nit: dito and below

    • Done

  • File chrome/browser/android/autofill_assistant/ui_controller_android.cc:

    • Done

    • Patch Set #2, Line 275:

       size_t fields_size = base::size(kLabelFields);
      if (!with_country) {
      --fields_size;
      }

      Commment here please. This is a slightly weird pattern.

    • Done

    • Done

To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
Gerrit-Change-Number: 3480016
Gerrit-PatchSet: 2
Gerrit-Owner: Sandro Maggi <sandr...@google.com>
Gerrit-Reviewer: Florian Gauger <f...@google.com>
Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
Gerrit-Attention: Florian Gauger <f...@google.com>
Gerrit-Comment-Date: Wed, 23 Feb 2022 09:44:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Florian Gauger <f...@google.com>
Gerrit-MessageType: comment

Sandro Maggi (Gerrit)

unread,
Feb 23, 2022, 4:44:31 AM2/23/22
to autofill_ass...@google.com, Luca Hunkeler, Chromium LUCI CQ, Florian Gauger, chromium...@chromium.org

Attention is currently required from: Florian Gauger.

Patch set 3:Commit-Queue +2

View Change

    To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
    Gerrit-Change-Number: 3480016
    Gerrit-PatchSet: 3
    Gerrit-Owner: Sandro Maggi <sandr...@google.com>
    Gerrit-Reviewer: Florian Gauger <f...@google.com>
    Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
    Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
    Gerrit-Attention: Florian Gauger <f...@google.com>
    Gerrit-Comment-Date: Wed, 23 Feb 2022 09:44:12 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Chromium LUCI CQ (Gerrit)

    unread,
    Feb 23, 2022, 5:32:25 AM2/23/22
    to Sandro Maggi, autofill_ass...@google.com, Luca Hunkeler, Florian Gauger, chromium...@chromium.org

    Chromium LUCI CQ submitted this change.

    View Change



    2 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: chrome/browser/android/autofill_assistant/ui_controller_android.cc
    Insertions: 9, Deletions: 5.

    @@ -58,6 +58,7 @@
    ConvertNativeOptionalStringToJava;
    using ::autofill_assistant::ui_controller_android_utils::CreateJavaInfoPopup;
    using ::base::android::AttachCurrentThread;
    +using ::base::android::ConvertUTF16ToJavaString;
    using ::base::android::ConvertUTF8ToJavaString;
    using ::base::android::JavaParamRef;
    using ::base::android::JavaRef;
    @@ -256,7 +257,7 @@
    const autofill::AutofillProfile* profile,
    bool with_country) {
    if (!profile) {
    - return base::android::ConvertUTF8ToJavaString(env, std::string());
    + return ConvertUTF8ToJavaString(env, std::string());
    }

    // The full name is not included in the label for shipping address. It is
    @@ -273,14 +274,17 @@
    autofill::ServerFieldType::ADDRESS_HOME_COUNTRY,
    };

    size_t fields_size = base::size(kLabelFields);
    +
    + // For the case where country is omitted, do not use the last field.
    if (!with_country) {
    --fields_size;
    }

    - return base::android::ConvertUTF16ToJavaString(
    - env,
    - profile->ConstructInferredLabel(kLabelFields, fields_size, fields_size,
    - base::android::GetDefaultLocaleString()));
    + return ConvertUTF16ToJavaString(
    + env, profile->ConstructInferredLabel(
    + kLabelFields, /* label_fields_size= */ fields_size,
    + /* num_fields_to_include= */ fields_size,
    + base::android::GetDefaultLocaleString()));
    }

    } // namespace
    ```
    ```
    The name of the file: chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java
    Insertions: 5, Deletions: 4.

    @@ -1140,11 +1140,12 @@
    }

    private AddressModel createAddressModel(PersonalDataManager.AutofillProfile profile) {
    - return new AddressModel(createDummyAddress(profile), /* fullDescription= */
    + String fullDescription =
    PersonalDataManager.getInstance()
    - .getShippingAddressLabelWithCountryForPaymentRequest(profile),
    - /* summaryDescription= */
    + .getShippingAddressLabelWithCountryForPaymentRequest(profile);
    + String summaryDescription =
    PersonalDataManager.getInstance()
    - .getShippingAddressLabelWithoutCountryForPaymentRequest(profile));
    + .getShippingAddressLabelWithoutCountryForPaymentRequest(profile);
    + return new AddressModel(createDummyAddress(profile), fullDescription, summaryDescription);
    }
    }
    ```
    ```
    The name of the file: chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAddressEditorAutofill.java
    Insertions: 8, Deletions: 8.

    @@ -47,17 +47,17 @@
    Callback<AutofillAddress> editorDoneCallback = editedAddress -> {
    assert (editedAddress != null && editedAddress.isComplete()
    && editedAddress.getProfile() != null);
    + String fullDescription = PersonalDataManager.getInstance()
    + .getShippingAddressLabelWithCountryForPaymentRequest(
    + editedAddress.getProfile());
    + String summaryDescription =
    + PersonalDataManager.getInstance()
    + .getShippingAddressLabelWithoutCountryForPaymentRequest(
    + editedAddress.getProfile());
    doneCallback.onResult(new AddressModel(
    AssistantAutofillUtilChrome.autofillProfileToAssistantAutofillProfile(
    editedAddress.getProfile()),
    - /* fullDescription= */
    - PersonalDataManager.getInstance()
    - .getShippingAddressLabelWithCountryForPaymentRequest(
    - editedAddress.getProfile()),
    - /* summaryDescription= */
    - PersonalDataManager.getInstance()
    - .getShippingAddressLabelWithoutCountryForPaymentRequest(
    - editedAddress.getProfile())));
    + fullDescription, summaryDescription));
    };

    Callback<AutofillAddress> editorCancelCallback =
    ```

    Approvals: Luca Hunkeler: Looks good to me Sandro Maggi: Commit
    [Autofill Assistant] Replace label generation

    This replaces the label generation for shipping addresses
    such that it no longer depends on Chrome code.

    Bug: b:220829993
    Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3480016
    Reviewed-by: Luca Hunkeler <hl...@google.com>
    Commit-Queue: Sandro Maggi <sandr...@google.com>
    Cr-Commit-Position: refs/heads/main@{#974110}
    ---
    M chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java
    M chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantShippingAddressSection.java
    M chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java
    M chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAddressEditorAutofill.java
    M chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAutofillUtilChrome.java
    M chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOptionModel.java
    M chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantPaymentInstrumentEditorAutofill.java
    M chrome/browser/android/autofill_assistant/ui_controller_android.cc
    8 files changed, 126 insertions(+), 55 deletions(-)


    To view, visit change 3480016. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib502480b25bc155aa183f45fb6390b367c3ded82
    Gerrit-Change-Number: 3480016
    Gerrit-PatchSet: 4
    Gerrit-Owner: Sandro Maggi <sandr...@google.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Florian Gauger <f...@google.com>
    Gerrit-Reviewer: Luca Hunkeler <hl...@google.com>
    Gerrit-Reviewer: Sandro Maggi <sandr...@google.com>
    Gerrit-MessageType: merged
    Reply all
    Reply to author
    Forward
    0 new messages