Skip to content

Commit

Permalink
[mullet m3] Rename Mullet M1 suggestion trigger source.
Browse files Browse the repository at this point in the history
Mullet M3 will allow users to trigger autofill suggestions for
unclassified fields. This will be done through the following
suggestion trigger sources:
* kManualFallbackAddress
* kManualFallbackPayments
* kManualFallbackPasswords

This CL renames the trigger source used for fields with
unrecognized autocomplete attribute in Mullet M1. The
corresponding AutofillTriggerSource is renamed to
kManualFallback.

Mullet M3 feature flag: AutofillForUnclassifiedFieldsAvailable.

Bug: 1493361
Change-Id: I4a3afa376c18d87915a6bf80f6d225c2afd07d10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974324
Reviewed-by: Mohamed Amir Yosef <mamir@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Florian Leimgruber <fleimgruber@google.com>
Commit-Queue: Timofey Chudakov <tchudakov@google.com>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1216836}
  • Loading branch information
Timofey Chudakov authored and Chromium LUCI CQ committed Oct 30, 2023
1 parent 8d38c74 commit 0cbdda6
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 53 deletions.
4 changes: 2 additions & 2 deletions chrome/browser/ui/autofill/autofill_context_menu_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ void AutofillContextMenuManager::
return;
}
driver.browser_events().RendererShouldTriggerSuggestions(
field->global_id(), AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized);
field->global_id(),
AutofillSuggestionTriggerSource::kManualFallbackAddress);
static_cast<BrowserAutofillManager&>(manager)
.GetAutocompleteUnrecognizedFallbackEventLogger()
.ContextMenuEntryAccepted(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ IN_PROC_BROWSER_TEST_F(

// Tests that when the fallback entry for ac=unrecognized fields is selected,
// suggestions are triggered with suggestion trigger source
// `kManualFallbackForAutocompleteUnrecognized`.
// `kManualFallbackAddress`.
IN_PROC_BROWSER_TEST_F(AutocompleteUnrecognizedFieldsTest,
AutocompleteUnrecognizedFallback_TriggerSuggestions) {
AddAutofillProfile(test::GetFullProfile());
Expand All @@ -454,8 +454,7 @@ IN_PROC_BROWSER_TEST_F(AutocompleteUnrecognizedFieldsTest,
RendererShouldTriggerSuggestions(
FieldGlobalId{LocalFrameToken(main_rfh()->GetFrameToken().value()),
form.fields[0].unique_renderer_id},
AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized));
AutofillSuggestionTriggerSource::kManualFallbackAddress));
autofill_context_menu_manager()->ExecuteCommand(
IDC_CONTENT_CONTEXT_AUTOFILL_FALLBACK_ADDRESS);
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ void AutofillPopupControllerImpl::Show(

trigger_source_ = trigger_source;
should_ignore_mouse_observed_outside_item_bounds_check_ =
trigger_source_ == AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized;
trigger_source_ ==
AutofillSuggestionTriggerSource::kManualFallbackAddress;

if (view_) {
OnSuggestionsChanged();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,7 @@ TEST_F(AutofillPopupControllerImplTest,
TEST_F(AutofillPopupControllerImplTest,
ManualFallBackTriggerSource_IgnoresClickOutsideCheck) {
ShowSuggestions(manager(), {PopupItemId::kAddressEntry},
AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized);
AutofillSuggestionTriggerSource::kManualFallbackAddress);

// Generate a popup, so it can be hidden later. It doesn't matter what the
// external_delegate thinks is being shown in the process, since we are just
Expand Down
7 changes: 3 additions & 4 deletions chrome/browser/ui/views/autofill/popup/popup_row_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,9 @@ class PopupRowView : public views::View, public views::ViewObserver {

// Whether the `mouse_observed_outside_item_bounds_` will be ignored or not.
// Today this happens when:
// 1. The AutofillSuggestionTriggerSource is
// `kManualFallbackForAutocompleteUnrecognized`. This is because in this
// situation even though the popup could appear behind the cursor, the user
// intention about opening it is explicit.
// 1. The AutofillSuggestionTriggerSource is `kManualFallbackAddress`. This is
// because in this situation even though the popup could appear behind the
// cursor, the user intention about opening it is explicit.
//
// 2. The suggestions are of autocomplete type and were regenerated due to a
// suggestion being removed. We want to ignore the check in this case because
Expand Down
9 changes: 3 additions & 6 deletions components/autofill/content/renderer/suggestion_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ bool ShouldAutofillOnEmptyValues(
case AutofillSuggestionTriggerSource::kFormControlElementClicked:
case AutofillSuggestionTriggerSource::kTextFieldDidReceiveKeyDown:
case AutofillSuggestionTriggerSource::kOpenTextDataListChooser:
case AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized:
case AutofillSuggestionTriggerSource::kManualFallbackAddress:
case AutofillSuggestionTriggerSource::kShowPromptAfterDialogClosed:
return true;
case AutofillSuggestionTriggerSource::kContentEditableClicked:
Expand All @@ -46,8 +45,7 @@ bool RequiresCaretAtEnd(AutofillSuggestionTriggerSource trigger_source) {
case AutofillSuggestionTriggerSource::kFormControlElementClicked:
case AutofillSuggestionTriggerSource::kContentEditableClicked:
case AutofillSuggestionTriggerSource::kOpenTextDataListChooser:
case AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized:
case AutofillSuggestionTriggerSource::kManualFallbackAddress:
case AutofillSuggestionTriggerSource::kShowPromptAfterDialogClosed:
return false;
// `kShowCardsFromAccount`, `kPasswordManager`, `kAndroidWebView` and `kiOS`
Expand Down Expand Up @@ -76,8 +74,7 @@ bool ShouldShowFullSuggestionListForPasswordManager(
case AutofillSuggestionTriggerSource::kTextFieldDidChange:
case AutofillSuggestionTriggerSource::kTextFieldDidReceiveKeyDown:
case AutofillSuggestionTriggerSource::kOpenTextDataListChooser:
case AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized:
case AutofillSuggestionTriggerSource::kManualFallbackAddress:
case AutofillSuggestionTriggerSource::kShowPromptAfterDialogClosed:
return false;
// `kShowCardsFromAccount`, `kPasswordManager`, `kAndroidWebView` and `kiOS`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,11 @@ AutofillTriggerSource TriggerSourceFromSuggestionTriggerSource(
#else
return AutofillTriggerSource::kPopup;
#endif // BUILDFLAG(IS_ANDROID)
case AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized:
case AutofillSuggestionTriggerSource::kManualFallbackAddress:
// Manual fallbacks are both a suggestion trigger source (e.g. through the
// context menu) and a trigger source (by selecting a suggestion generated
// through the context menu).
return AutofillTriggerSource::kManualFallbackForAutocompleteUnrecognized;
return AutofillTriggerSource::kManualFallback;
}
NOTREACHED_NORETURN();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1209,12 +1209,10 @@ TEST_F(AutofillExternalDelegateUnitTest, AcceptSuggestion_TriggerSource) {
external_delegate_->DidAcceptSuggestion(suggestion, /*position=*/1,
suggestion_source);

// Expect that `kManualFallbackForAutocompleteUnrecognized` translates to
// trigger source of the same name.
suggestion_source = AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized;
expected_source =
AutofillTriggerSource::kManualFallbackForAutocompleteUnrecognized;
// Expect that `kManualFallbackAddress` translates to the manual fallback
// trigger source.
suggestion_source = AutofillSuggestionTriggerSource::kManualFallbackAddress;
expected_source = AutofillTriggerSource::kManualFallback;
EXPECT_CALL(
*browser_autofill_manager_,
FillOrPreviewProfileForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,7 @@ std::vector<Suggestion> AutofillSuggestionGenerator::GetSuggestionsForProfiles(
// available profiles should be shown. Selecting a suggestion overwrites the
// triggering field's value.
const std::u16string field_value_for_filtering =
trigger_source != AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized
trigger_source != AutofillSuggestionTriggerSource::kManualFallbackAddress
? triggering_field.value
: u"";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1529,8 +1529,7 @@ TEST_F(AutofillSuggestionGeneratorTest, GetSuggestionsForProfiles_Filtering) {
->GetSuggestionsForProfiles(
{NAME_FIRST}, triggering_field, NAME_FIRST,
/*last_targeted_fields=*/absl::nullopt,
AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized)
AutofillSuggestionTriggerSource::kManualFallbackAddress)
.size(),
2u);
}
Expand Down
8 changes: 4 additions & 4 deletions components/autofill/core/browser/autofill_trigger_details.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ enum class AutofillTriggerSource {
// Autofill was triggered from a Fast Checkout run.
kFastCheckout = 8,
// Filling/preview was triggered through a suggestion generated by manual
// fallbacks for autocomplete=unrecognized fields. Contrary to regular
// Autofill, Autofill with this trigger source fills autocomplete=unrecognized
// fields.
kManualFallbackForAutocompleteUnrecognized = 9
// fallbacks from the Chrome context menu. Contrary to regular address
// Autofill, Autofill with this trigger source fills both classified and
// unclassified form fields.
kManualFallback = 9
};

// Holds the details about a filling operation. The `trigger_source` field
Expand Down
13 changes: 5 additions & 8 deletions components/autofill/core/browser/browser_autofill_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,8 @@ bool ShouldShowSuggestionsForAutocompleteUnrecognizedFields(
return base::FeatureList::IsEnabled(
features::kAutofillSuggestionsForAutocompleteUnrecognizedFieldsOnMobile);
#else
return trigger_source == AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized;
return trigger_source ==
AutofillSuggestionTriggerSource::kManualFallbackAddress;
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
}

Expand Down Expand Up @@ -1066,8 +1066,7 @@ bool BrowserAutofillManager::WasSuggestionPreviouslyHidden(
/*optional_type_groups_originally_filled=*/nullptr,
/*skip_unrecognized_autocomplete_fields=*/
trigger_source !=
AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized,
AutofillSuggestionTriggerSource::kManualFallbackAddress,
/*is_refill=*/false)
: std::vector<FieldFillingSkipReason>(
form_structure->field_count(),
Expand Down Expand Up @@ -2495,8 +2494,7 @@ void BrowserAutofillManager::FillOrPreviewDataModelForm(
filling_context ? &filling_context->type_groups_originally_filled
: nullptr,
/*skip_unrecognized_autocomplete_fields=*/
trigger_details.trigger_source !=
AutofillTriggerSource::kManualFallbackForAutocompleteUnrecognized,
trigger_details.trigger_source != AutofillTriggerSource::kManualFallback,
is_refill);

constexpr DenseSet<FieldFillingSkipReason> pre_ukm_logging_skips{
Expand Down Expand Up @@ -2825,8 +2823,7 @@ std::vector<Suggestion> BrowserAutofillManager::GetProfileSuggestions(
: kAllServerFieldTypes,
/*optional_type_groups_originally_filled=*/nullptr,
/*skip_unrecognized_autocomplete_fields=*/trigger_source !=
AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized,
AutofillSuggestionTriggerSource::kManualFallbackAddress,
/*is_refill=*/false)
: std::vector<FieldFillingSkipReason>(
form_structure.field_count(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1603,9 +1603,8 @@ TEST_F(BrowserAutofillManagerTest,
// suggestions are returned.
// Two, because the fixture created three profiles during set up, one of which
// is empty and cannot be suggested (see `CreateTestAutofillProfiles()`).
GetAutofillSuggestions(form, field0,
AutofillSuggestionTriggerSource::
kManualFallbackForAutocompleteUnrecognized);
GetAutofillSuggestions(
form, field0, AutofillSuggestionTriggerSource::kManualFallbackAddress);
external_delegate()->CheckSuggestionCount(field0.global_id(), 2);

// Expect that two suggestions are returned for all other fields.
Expand Down Expand Up @@ -3732,8 +3731,7 @@ TEST_F(BrowserAutofillManagerTest, AutocompleteUnrecognizedFillingBehavior) {
browser_autofill_manager_->FillOrPreviewProfileForm(
mojom::ActionPersistence::kFill, form, form.fields[0],
*personal_data().GetProfileByGUID(kElvisProfileGuid),
{.trigger_source =
AutofillTriggerSource::kManualFallbackForAutocompleteUnrecognized});
{.trigger_source = AutofillTriggerSource::kManualFallback});

ExpectFilledForm(filled_form, GetElvisAddressFillData(),
/*card_fill_data=*/absl::nullopt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AutocompleteUnrecognizedFallbackEventLoggerTest
// Show suggestions on the first field of the `form`.
void ShowSuggestions(const FormData& form) {
// On desktop, suggestion on an ac=unrecognized field can only be triggered
// through source kManualFallbackForAutocompleteUnrecognized. However, on
// through source kManualFallbackAddress. However, on
// mobile any trigger source works. For the test, it is irrelevant, since
// the metric only cares about the autocomplete attribute, not the trigger
// source.
Expand Down
6 changes: 3 additions & 3 deletions components/autofill/core/common/mojom/autofill_types.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ enum AutofillSuggestionTriggerSource {
// This code currently doesn't distinguish between different suggestion
// trigger sources. They are all treated as `kiOS`. See crbug.com/1448447.
kiOS,
// Suggestions triggered by selecting the manual fallback entry for
// autocomplete=unrecognized fields in the context menu.
kManualFallbackForAutocompleteUnrecognized,
// Suggestions triggered by selecting the Autofill address manual fallback
// entry from the Chrome context menu.
kManualFallbackAddress,
// Suggestions triggered by the user closing a dialog after performing some
// action.
kShowPromptAfterDialogClosed,
Expand Down

0 comments on commit 0cbdda6

Please sign in to comment.