diff options
Diffstat (limited to 'components/autofill/core')
4 files changed, 39 insertions, 25 deletions
diff --git a/components/autofill/core/browser/autofill_external_delegate.cc b/components/autofill/core/browser/autofill_external_delegate.cc index 1f711c7..5f8a3e0 100644 --- a/components/autofill/core/browser/autofill_external_delegate.cc +++ b/components/autofill/core/browser/autofill_external_delegate.cc @@ -88,9 +88,11 @@ void AutofillExternalDelegate::OnSuggestionsReturned( // Add or hide warnings as appropriate. ApplyAutofillWarnings(&suggestions); +#if !defined(OS_ANDROID) // Add a separator to go between the values and menu items. suggestions.push_back(Suggestion()); suggestions.back().frontend_id = POPUP_ITEM_ID_SEPARATOR; +#endif if (should_show_scan_credit_card_) { Suggestion scan_credit_card( @@ -118,10 +120,12 @@ void AutofillExternalDelegate::OnSuggestionsReturned( if (has_suggestion_) ApplyAutofillOptions(&suggestions); +#if !defined(OS_ANDROID) // Remove the separator if it is the last element. DCHECK_GT(suggestions.size(), 0U); if (suggestions.back().frontend_id == POPUP_ITEM_ID_SEPARATOR) suggestions.pop_back(); +#endif // If anything else is added to modify the values after inserting the data // list, AutofillPopupControllerImpl::UpdateDataListValues will need to be @@ -359,12 +363,14 @@ void AutofillExternalDelegate::InsertDataListValues( if (data_list_values_.empty()) return; +#if !defined(OS_ANDROID) // Insert the separator between the datalist and Autofill values (if there // are any). if (!suggestions->empty()) { suggestions->insert(suggestions->begin(), Suggestion()); (*suggestions)[0].frontend_id = POPUP_ITEM_ID_SEPARATOR; } +#endif // Insert the datalist elements at the beginning. suggestions->insert(suggestions->begin(), data_list_values_.size(), diff --git a/components/autofill/core/browser/autofill_external_delegate_unittest.cc b/components/autofill/core/browser/autofill_external_delegate_unittest.cc index 04af535..e9bef06 100644 --- a/components/autofill/core/browser/autofill_external_delegate_unittest.cc +++ b/components/autofill/core/browser/autofill_external_delegate_unittest.cc @@ -157,15 +157,15 @@ TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { IssueOnQuery(kQueryId); // The enums must be cast to ints to prevent compile errors on linux_rel. + auto element_ids = testing::ElementsAre( + kAutofillProfileId, +#if !defined(OS_ANDROID) + static_cast<int>(POPUP_ITEM_ID_SEPARATOR), +#endif + static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS)); EXPECT_CALL( autofill_client_, - ShowAutofillPopup(_, - _, - SuggestionVectorIdsAre(testing::ElementsAre( - kAutofillProfileId, - static_cast<int>(POPUP_ITEM_ID_SEPARATOR), - static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS))), - _)); + ShowAutofillPopup(_, _, SuggestionVectorIdsAre(element_ids), _)); // This should call ShowAutofillPopup. std::vector<Suggestion> autofill_item; @@ -199,17 +199,19 @@ TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) { data_list_items); // The enums must be cast to ints to prevent compile errors on linux_rel. + auto element_ids = testing::ElementsAre( + static_cast<int>(POPUP_ITEM_ID_DATALIST_ENTRY), +#if !defined(OS_ANDROID) + static_cast<int>(POPUP_ITEM_ID_SEPARATOR), +#endif + kAutofillProfileId, +#if !defined(OS_ANDROID) + static_cast<int>(POPUP_ITEM_ID_SEPARATOR), +#endif + static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS)); EXPECT_CALL( autofill_client_, - ShowAutofillPopup(_, - _, - SuggestionVectorIdsAre(testing::ElementsAre( - static_cast<int>(POPUP_ITEM_ID_DATALIST_ENTRY), - static_cast<int>(POPUP_ITEM_ID_SEPARATOR), - kAutofillProfileId, - static_cast<int>(POPUP_ITEM_ID_SEPARATOR), - static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS))), - _)); + ShowAutofillPopup(_, _, SuggestionVectorIdsAre(element_ids), _)); // This should call ShowAutofillPopup. std::vector<Suggestion> autofill_item; @@ -253,17 +255,19 @@ TEST_F(AutofillExternalDelegateUnitTest, UpdateDataListWhileShowingPopup) { data_list_items); // The enums must be cast to ints to prevent compile errors on linux_rel. + auto element_ids = testing::ElementsAre( + static_cast<int>(POPUP_ITEM_ID_DATALIST_ENTRY), +#if !defined(OS_ANDROID) + static_cast<int>(POPUP_ITEM_ID_SEPARATOR), +#endif + kAutofillProfileId, +#if !defined(OS_ANDROID) + static_cast<int>(POPUP_ITEM_ID_SEPARATOR), +#endif + static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS)); EXPECT_CALL( autofill_client_, - ShowAutofillPopup(_, - _, - SuggestionVectorIdsAre(testing::ElementsAre( - static_cast<int>(POPUP_ITEM_ID_DATALIST_ENTRY), - static_cast<int>(POPUP_ITEM_ID_SEPARATOR), - kAutofillProfileId, - static_cast<int>(POPUP_ITEM_ID_SEPARATOR), - static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS))), - _)); + ShowAutofillPopup(_, _, SuggestionVectorIdsAre(element_ids), _)); // Ensure the popup is displayed. std::vector<Suggestion> autofill_item; diff --git a/components/autofill/core/common/autofill_switches.cc b/components/autofill/core/common/autofill_switches.cc index 6cf1c85..83c38a1 100644 --- a/components/autofill/core/common/autofill_switches.cc +++ b/components/autofill/core/common/autofill_switches.cc @@ -28,6 +28,9 @@ const char kDisablePasswordGeneration[] = "disable-password-generation"; // The "disable" flag for kEnableSingleClickAutofill. const char kDisableSingleClickAutofill[] = "disable-single-click-autofill"; +const char kEnableAccessorySuggestionView[] = + "enable-autofill-keyboard-accessory-view"; + // Enables using device's camera to scan a new credit card when filling out a // credit card form. const char kEnableCreditCardScan[] = "enable-credit-card-scan"; diff --git a/components/autofill/core/common/autofill_switches.h b/components/autofill/core/common/autofill_switches.h index 7ab7e07..bc1840d 100644 --- a/components/autofill/core/common/autofill_switches.h +++ b/components/autofill/core/common/autofill_switches.h @@ -15,6 +15,7 @@ extern const char kDisableFillOnAccountSelect[]; extern const char kDisableOfferStoreUnmaskedWalletCards[]; extern const char kDisablePasswordGeneration[]; extern const char kDisableSingleClickAutofill[]; +extern const char kEnableAccessorySuggestionView[]; extern const char kEnableCreditCardScan[]; extern const char kEnableFillOnAccountSelect[]; extern const char kEnableFillOnAccountSelectNoHighlighting[]; |