Commit 7eb17ca1 authored by Reda Tawfik's avatar Reda Tawfik Committed by Commit Bot

[Android][Mfill] Always show keyboard accessory icons

This CL allows keyboard accessory icons to be always shown on username
fields if AllPasswordsBottomSheet is enabled.

Bug: 1133351, 1104132
Change-Id: I835481caa89d8fc0823f7e00f11375d7729485c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438396
Commit-Queue: Reda Tawfik <redatawfik@google.com>
Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818413}
parent 15e9bde7
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "components/autofill/core/common/autofill_util.h" #include "components/autofill/core/common/autofill_util.h"
#include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/core/service_access_type.h"
#include "components/password_manager/core/browser/credential_cache.h" #include "components/password_manager/core/browser/credential_cache.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
using autofill::AccessoryAction; using autofill::AccessoryAction;
...@@ -243,7 +244,9 @@ bool ManualFillingControllerImpl::ShouldShowAccessory() const { ...@@ -243,7 +244,9 @@ bool ManualFillingControllerImpl::ShouldShowAccessory() const {
autofill::features::kAutofillManualFallbackAndroid)) { autofill::features::kAutofillManualFallbackAndroid)) {
return focused_field_type_ == FocusedFieldType::kFillablePasswordField || return focused_field_type_ == FocusedFieldType::kFillablePasswordField ||
(focused_field_type_ == FocusedFieldType::kFillableUsernameField && (focused_field_type_ == FocusedFieldType::kFillableUsernameField &&
available_sources_.contains(FillingSource::PASSWORD_FALLBACKS)); (base::FeatureList::IsEnabled(
password_manager::features::kFillingPasswordsFromAnyOrigin) ||
available_sources_.contains(FillingSource::PASSWORD_FALLBACKS)));
} }
switch (focused_field_type_) { switch (focused_field_type_) {
// Always show on password fields to provide management and generation. // Always show on password fields to provide management and generation.
...@@ -253,7 +256,9 @@ bool ManualFillingControllerImpl::ShouldShowAccessory() const { ...@@ -253,7 +256,9 @@ bool ManualFillingControllerImpl::ShouldShowAccessory() const {
// If there are suggestions, show on usual form fields. // If there are suggestions, show on usual form fields.
case FocusedFieldType::kFillableUsernameField: case FocusedFieldType::kFillableUsernameField:
case FocusedFieldType::kFillableNonSearchField: case FocusedFieldType::kFillableNonSearchField:
return !available_sources_.empty(); return !available_sources_.empty() ||
base::FeatureList::IsEnabled(
password_manager::features::kFillingPasswordsFromAnyOrigin);
// Even if there are suggestions, don't show on search fields and textareas. // Even if there are suggestions, don't show on search fields and textareas.
case FocusedFieldType::kFillableSearchField: case FocusedFieldType::kFillableSearchField:
......
...@@ -179,6 +179,19 @@ TEST_F(ManualFillingControllerTest, ShowsAccessoryWithSuggestions) { ...@@ -179,6 +179,19 @@ TEST_F(ManualFillingControllerTest, ShowsAccessoryWithSuggestions) {
controller()->RefreshSuggestions(populate_sheet(AccessoryTabType::PASSWORDS)); controller()->RefreshSuggestions(populate_sheet(AccessoryTabType::PASSWORDS));
} }
TEST_F(ManualFillingControllerTest,
AlwaysShowsAccessoryForUsernameFieldsIfFillingAcrossOriginEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
password_manager::features::kFillingPasswordsFromAnyOrigin);
EXPECT_CALL(*view(), ShowWhenKeyboardIsVisible());
FocusFieldAndClearExpectations(FocusedFieldType::kFillableUsernameField);
EXPECT_CALL(*view(), Hide()).Times(0);
controller()->RefreshSuggestions(empty_passwords_sheet());
}
TEST_F(ManualFillingControllerTest, DoesntShowFallbacksOutsideUsernameInV1) { TEST_F(ManualFillingControllerTest, DoesntShowFallbacksOutsideUsernameInV1) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures( scoped_feature_list.InitWithFeatures(
......
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