| Index: components/autofill/core/common/autofill_util.cc
|
| diff --git a/components/autofill/core/common/autofill_util.cc b/components/autofill/core/common/autofill_util.cc
|
| index c20ac562e437da1251f2ebd97580db54080fa7ee..ffa82290186a1c692d57b6cc69a24c4fb255cd46 100644
|
| --- a/components/autofill/core/common/autofill_util.cc
|
| +++ b/components/autofill/core/common/autofill_util.cc
|
| @@ -7,17 +7,29 @@
|
| #include <algorithm>
|
|
|
| #include "base/command_line.h"
|
| +#include "base/feature_list.h"
|
| #include "base/i18n/case_conversion.h"
|
| #include "base/metrics/field_trial.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_piece.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "build/build_config.h"
|
| #include "components/autofill/core/common/autofill_switches.h"
|
| +#include "components/variations/variations_associated_data.h"
|
|
|
| namespace autofill {
|
|
|
| +const base::Feature kAutofillKeyboardAccessory{
|
| + "AutofillKeyboardAccessory", base::FEATURE_DISABLED_BY_DEFAULT};
|
| +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[] = " .,-_@";
|
| @@ -49,13 +61,45 @@ bool IsShowAutofillSignaturesEnabled() {
|
|
|
| bool IsKeyboardAccessoryEnabled() {
|
| #if defined(OS_ANDROID)
|
| - return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableAccessorySuggestionView) ||
|
| - (base::FieldTrialList::FindFullName("AutofillKeyboardAccessory") ==
|
| - "Enabled" &&
|
| - !base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kDisableAccessorySuggestionView));
|
| + return base::FeatureList::IsEnabled(kAutofillKeyboardAccessory);
|
| +#else // !defined(OS_ANDROID)
|
| + return false;
|
| +#endif
|
| +}
|
| +
|
| +unsigned int GetKeyboardAccessoryAnimationDuration() {
|
| +#if defined(OS_ANDROID)
|
| + unsigned int value;
|
| + const std::string param_value = variations::GetVariationParamValueByFeature(
|
| + kAutofillKeyboardAccessory,
|
| + kAutofillKeyboardAccessoryAnimationDurationKey);
|
| + if (!param_value.empty() && base::StringToUint(param_value, &value))
|
| + return value;
|
| + return 0;
|
| +#else // !defined(OS_ANDROID)
|
| + NOTREACHED();
|
| + return 0;
|
| +#endif
|
| +}
|
| +
|
| +bool ShouldLimitKeyboardAccessorySuggestionLabelWidth() {
|
| +#if defined(OS_ANDROID)
|
| + const std::string param_value = variations::GetVariationParamValueByFeature(
|
| + kAutofillKeyboardAccessory, kAutofillKeyboardAccessoryLimitLabelWidthKey);
|
| + return param_value == "true";
|
| +#else // !defined(OS_ANDROID)
|
| + NOTREACHED();
|
| + return false;
|
| +#endif
|
| +}
|
| +
|
| +bool IsHintEnabledInKeyboardAccessory() {
|
| +#if defined(OS_ANDROID)
|
| + const std::string param_value = variations::GetVariationParamValueByFeature(
|
| + kAutofillKeyboardAccessory, kAutofillKeyboardAccessoryHintKey);
|
| + return param_value == "true";
|
| #else // !defined(OS_ANDROID)
|
| + NOTREACHED();
|
| return false;
|
| #endif
|
| }
|
|
|