Commit b268b3ed authored by Jeffrey Cohen's avatar Jeffrey Cohen Committed by Commit Bot

[autofill] Respect company name flag when doing address autofill on Android.

  Before this CL, when autofilling addresses, the company name was always
filled in if it was specified as part of a country's address fields.

  However, we want to remove the company field from autofill. This is being
rolled out via a Flag and finch config.

  The initial CL that addressed this in https://crrev.com/c/1315536 did not
make any changes to the Android platform, but this CL updates the
bridge between C++ and Java code to filter out the company field if applicable.

Bug: 890972
Change-Id: I449603a1d6e8610bcab031c31807c39e7bea9cd1
Reviewed-on: https://chromium-review.googlesource.com/c/1330791
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608429}
parent 214660f4
...@@ -51,6 +51,7 @@ namespace { ...@@ -51,6 +51,7 @@ namespace {
const base::Feature* kFeaturesExposedToJava[] = { const base::Feature* kFeaturesExposedToJava[] = {
&autofill::features::kAutofillManualFallbackAndroid, &autofill::features::kAutofillManualFallbackAndroid,
&autofill::features::kAutofillRefreshStyleAndroid, &autofill::features::kAutofillRefreshStyleAndroid,
&autofill::features::kAutofillEnableCompanyName,
&contextual_suggestions::kContextualSuggestionsButton, &contextual_suggestions::kContextualSuggestionsButton,
&contextual_suggestions::kContextualSuggestionsIPHReverseScroll, &contextual_suggestions::kContextualSuggestionsIPHReverseScroll,
&contextual_suggestions::kContextualSuggestionsOptOut, &contextual_suggestions::kContextualSuggestionsOptOut,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "components/autofill/core/browser/autofill_country.h" #include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/common/autofill_features.h"
#include "jni/AutofillProfileBridge_jni.h" #include "jni/AutofillProfileBridge_jni.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_field.h" #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_field.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_metadata.h" #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_metadata.h"
...@@ -121,6 +122,10 @@ JNI_AutofillProfileBridge_GetAddressUiComponents( ...@@ -121,6 +122,10 @@ JNI_AutofillProfileBridge_GetAddressUiComponents(
country_code, localization, language_code, &best_language_tag); country_code, localization, language_code, &best_language_tag);
for (const auto& ui_component : ui_components) { for (const auto& ui_component : ui_components) {
if (ui_component.field == AddressField::ORGANIZATION &&
!base::FeatureList::IsEnabled(features::kAutofillEnableCompanyName)) {
continue;
}
component_labels.push_back(ui_component.name); component_labels.push_back(ui_component.name);
component_required.push_back( component_required.push_back(
IsFieldRequired(ui_component.field, country_code)); IsFieldRequired(ui_component.field, country_code));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment