Commit 704b0f5e authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

[Android][Mfill] Remove variations for keyboard accessory

This CL removes unused variations along with the dead code they were
enabling.

Bug: 1124732
Change-Id: I729a2ed83e9652f74859477a6943a77b871e68b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404344Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarMatthias Körber <koerber@google.com>
Commit-Queue: Friedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806129}
parent d9530b08
......@@ -143,7 +143,6 @@ class KeyboardAccessoryMediator
case PopupItemId.ITEM_ID_SCAN_CREDIT_CARD:
case PopupItemId.ITEM_ID_TITLE:
case PopupItemId.ITEM_ID_USERNAME_ENTRY:
case PopupItemId.ITEM_ID_CREATE_HINT:
case PopupItemId.ITEM_ID_ACCOUNT_STORAGE_PASSWORD_ENTRY:
case PopupItemId.ITEM_ID_ACCOUNT_STORAGE_USERNAME_ENTRY:
return true;
......
......@@ -830,43 +830,6 @@ const FeatureEntry::FeatureVariation
base::size(kIsolatedPrerenderPrefetchLimitFifteen), nullptr},
};
#if defined(OS_ANDROID)
const FeatureEntry::FeatureParam
kAutofillKeyboardAccessoryFeatureVariationAnimationDuration[] = {
{autofill::kAutofillKeyboardAccessoryAnimationDurationKey, "1000"}};
const FeatureEntry::FeatureParam
kAutofillKeyboardAccessoryFeatureVariationLimitLabelWidth[] = {
{autofill::kAutofillKeyboardAccessoryLimitLabelWidthKey, "true"}};
const FeatureEntry::FeatureParam
kAutofillKeyboardAccessoryFeatureVariationShowHint[] = {
{autofill::kAutofillKeyboardAccessoryHintKey, "true"}};
const FeatureEntry::FeatureParam
kAutofillKeyboardAccessoryFeatureVariationAnimateWithHint[] = {
{autofill::kAutofillKeyboardAccessoryAnimationDurationKey, "1000"},
{autofill::kAutofillKeyboardAccessoryHintKey, "true"}};
const FeatureEntry::FeatureVariation
kAutofillKeyboardAccessoryFeatureVariations[] = {
{"Animate", kAutofillKeyboardAccessoryFeatureVariationAnimationDuration,
base::size(
kAutofillKeyboardAccessoryFeatureVariationAnimationDuration),
nullptr},
{"Limit label width",
kAutofillKeyboardAccessoryFeatureVariationLimitLabelWidth,
base::size(kAutofillKeyboardAccessoryFeatureVariationLimitLabelWidth),
nullptr},
{"Show hint", kAutofillKeyboardAccessoryFeatureVariationShowHint,
base::size(kAutofillKeyboardAccessoryFeatureVariationShowHint),
nullptr},
{"Animate with hint",
kAutofillKeyboardAccessoryFeatureVariationAnimateWithHint,
base::size(kAutofillKeyboardAccessoryFeatureVariationAnimateWithHint),
nullptr}};
#endif // OS_ANDROID
const FeatureEntry::Choice kMemlogModeChoices[] = {
{flags_ui::kGenericExperimentChoiceDisabled, "", ""},
{flag_descriptions::kMemlogModeMinimal, heap_profiling::kMemlogMode,
......@@ -3122,10 +3085,7 @@ const FeatureEntry kFeatureEntries[] = {
{"autofill-keyboard-accessory-view",
flag_descriptions::kAutofillAccessoryViewName,
flag_descriptions::kAutofillAccessoryViewDescription, kOsAndroid,
FEATURE_WITH_PARAMS_VALUE_TYPE(
autofill::features::kAutofillKeyboardAccessory,
kAutofillKeyboardAccessoryFeatureVariations,
"AutofillKeyboardAccessory")},
FEATURE_VALUE_TYPE(autofill::features::kAutofillKeyboardAccessory)},
#endif // OS_ANDROID
#if defined(OS_MAC)
{"mac-syscall-sandbox", flag_descriptions::kMacSyscallSandboxName,
......
......@@ -63,8 +63,7 @@ void AutofillKeyboardAccessoryAdapter::OnSuggestionsChanged() {
front_element_ = base::nullopt;
for (int i = 0; i < GetLineCount(); ++i) {
const Suggestion& suggestion = controller_->GetSuggestionAt(i);
if (suggestion.frontend_id != POPUP_ITEM_ID_CLEAR_FORM &&
suggestion.frontend_id != POPUP_ITEM_ID_CREATE_HINT) {
if (suggestion.frontend_id != POPUP_ITEM_ID_CLEAR_FORM) {
labels_.push_back(CreateLabel(suggestion));
continue;
}
......
......@@ -41,7 +41,6 @@ const struct TypeClicks kClickTestCase[] = {
{autofill::POPUP_ITEM_ID_TITLE, 1},
{autofill::POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO, 1},
{autofill::POPUP_ITEM_ID_USERNAME_ENTRY, 1},
{autofill::POPUP_ITEM_ID_CREATE_HINT, 1},
{autofill::POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY, 1},
{autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_OPT_IN, 1},
{autofill::POPUP_ITEM_ID_PASSWORD_ACCOUNT_STORAGE_RE_SIGNIN, 1},
......
......@@ -400,8 +400,7 @@ void AutofillExternalDelegate::ApplyAutofillOptions(
}
// Append the 'Autofill settings' menu item, or the menu item specified in the
// popup layout experiment. If we do not include |POPUP_ITEM_ID_CLEAR_FORM|,
// include a hint for keyboard accessory.
// popup layout experiment.
suggestions->push_back(Suggestion(GetSettingsSuggestionValue()));
suggestions->back().frontend_id = POPUP_ITEM_ID_AUTOFILL_OPTIONS;
// On Android and Desktop, Google Pay branding is shown along with Settings.
......@@ -416,18 +415,6 @@ void AutofillExternalDelegate::ApplyAutofillOptions(
: "googlePay";
#endif
}
#if defined(OS_ANDROID)
if (IsKeyboardAccessoryEnabled()) {
suggestions->back().icon = "settings";
if (IsHintEnabledInKeyboardAccessory() && !query_field_.is_autofilled) {
Suggestion create_icon;
create_icon.icon = "create";
create_icon.frontend_id = POPUP_ITEM_ID_CREATE_HINT;
suggestions->push_back(create_icon);
}
}
#endif
}
void AutofillExternalDelegate::InsertDataListValues(
......
......@@ -23,7 +23,6 @@ enum PopupItemId {
POPUP_ITEM_ID_TITLE = -8,
POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO = -9,
POPUP_ITEM_ID_USERNAME_ENTRY = -11,
POPUP_ITEM_ID_CREATE_HINT = -12,
POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY = -13,
POPUP_ITEM_ID_GENERATE_PASSWORD_ENTRY = -14,
POPUP_ITEM_ID_SHOW_ACCOUNT_CARDS = -15,
......
......@@ -27,13 +27,6 @@ using mojom::FocusedFieldType;
using mojom::SubmissionIndicatorEvent;
using mojom::SubmissionSource;
const char kAutofillKeyboardAccessoryAnimationDurationKey[] =
"animation_duration_millis";
const char kAutofillKeyboardAccessoryLimitLabelWidthKey[] =
"should_limit_label_width";
const char kAutofillKeyboardAccessoryHintKey[] =
"is_hint_shown_before_suggestion";
namespace {
const char kSplitCharacters[] = " .,-_@";
......@@ -42,9 +35,9 @@ template <typename Char>
struct Compare : base::CaseInsensitiveCompareASCII<Char> {
explicit Compare(bool case_sensitive) : case_sensitive_(case_sensitive) {}
bool operator()(Char x, Char y) const {
return case_sensitive_ ? (x == y)
: base::CaseInsensitiveCompareASCII<Char>::
operator()(x, y);
return case_sensitive_
? (x == y)
: base::CaseInsensitiveCompareASCII<Char>::operator()(x, y);
}
private:
......@@ -78,38 +71,6 @@ bool IsTouchToFillEnabled() {
#endif
}
unsigned int GetKeyboardAccessoryAnimationDuration() {
#if defined(OS_ANDROID)
return base::GetFieldTrialParamByFeatureAsInt(
kAutofillKeyboardAccessory,
kAutofillKeyboardAccessoryAnimationDurationKey, 0);
#else // !defined(OS_ANDROID)
NOTREACHED();
return 0;
#endif
}
bool ShouldLimitKeyboardAccessorySuggestionLabelWidth() {
#if defined(OS_ANDROID)
return base::GetFieldTrialParamByFeatureAsBool(
kAutofillKeyboardAccessory, kAutofillKeyboardAccessoryLimitLabelWidthKey,
false);
#else // !defined(OS_ANDROID)
NOTREACHED();
return false;
#endif
}
bool IsHintEnabledInKeyboardAccessory() {
#if defined(OS_ANDROID)
return base::GetFieldTrialParamByFeatureAsBool(
kAutofillKeyboardAccessory, kAutofillKeyboardAccessoryHintKey, false);
#else // !defined(OS_ANDROID)
NOTREACHED();
return false;
#endif
}
bool FieldIsSuggestionSubstringStartingOnTokenBoundary(
const base::string16& suggestion,
const base::string16& field_contents,
......@@ -143,7 +104,7 @@ size_t GetTextSelectionStart(const base::string16& suggestion,
(it = std::search(
it, suggestion.end(), field_contents.begin(), field_contents.end(),
Compare<base::string16::value_type>(case_sensitive))) !=
suggestion.end();
suggestion.end();
++it) {
if (it == suggestion.begin() ||
kSplitChars.find(*(it - 1)) != std::string::npos) {
......
......@@ -20,10 +20,6 @@ struct Feature;
namespace autofill {
extern const char kAutofillKeyboardAccessoryAnimationDurationKey[];
extern const char kAutofillKeyboardAccessoryLimitLabelWidthKey[];
extern const char kAutofillKeyboardAccessoryHintKey[];
// The length of the GUIDs used for local autofill data. It is different than
// the length used for server autofill data.
constexpr int kLocalGuidSize = 36;
......@@ -41,17 +37,6 @@ bool IsKeyboardAccessoryEnabled();
// Returns whether the Touch To Fill feature is enabled.
bool IsTouchToFillEnabled();
// Returns animation duration for keyboard accessory. If 0, we do not animate.
unsigned int GetKeyboardAccessoryAnimationDuration();
// Returns true if we must limit width of keyboard accessory suggestion label to
// half of device's pixel width.
bool ShouldLimitKeyboardAccessorySuggestionLabelWidth();
// Returns true if we show a hint in the keyboard accessory suggestions to call
// attention to the availability of autofill suggestions.
bool IsHintEnabledInKeyboardAccessory();
// A token is a sequences of contiguous characters separated by any of the
// characters that are part of delimiter set {' ', '.', ',', '-', '_', '@'}.
......
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