Commit 32290f62 authored by ramankk@chromium.org's avatar ramankk@chromium.org

Autofill:Autocheckout: In addition to "Enable Experimental Form filling" flag,...

Autofill:Autocheckout: In addition to "Enable Experimental Form filling" flag, support second method of enabling Autocheckout: using finch experiment. Autocheckout will be enabled if either of the conditions is true. Will remove "Enable experimental form filling" flag, once finch experiment is setup completely.


BUG=230026

Review URL: https://chromiumcodereview.appspot.com/13811045

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194767 0039d316-1c4b-4281-b951-d872f2087c98
parent 0248d920
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/strings/string_split.h" #include "base/strings/string_split.h"
#include "components/autofill/common/autofill_switches.h" #include "components/autofill/common/autofill_switches.h"
...@@ -41,7 +42,8 @@ WhitelistManager::WhitelistManager() ...@@ -41,7 +42,8 @@ WhitelistManager::WhitelistManager()
: callback_is_pending_(false), : callback_is_pending_(false),
experimental_form_filling_enabled_( experimental_form_filling_enabled_(
CommandLine::ForCurrentProcess()->HasSwitch( CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalFormFilling)), switches::kEnableExperimentalFormFilling) ||
base::FieldTrialList::FindFullName("Autocheckout") == "Yes"),
bypass_autocheckout_whitelist_( bypass_autocheckout_whitelist_(
CommandLine::ForCurrentProcess()->HasSwitch( CommandLine::ForCurrentProcess()->HasSwitch(
switches::kBypassAutocheckoutWhitelist)) { switches::kBypassAutocheckoutWhitelist)) {
......
...@@ -879,6 +879,7 @@ void AutofillManager::OnLoadedServerPredictions( ...@@ -879,6 +879,7 @@ void AutofillManager::OnLoadedServerPredictions(
page_meta_data.get(), page_meta_data.get(),
*metric_logger_); *metric_logger_);
if (!GetAutocheckoutURLPrefix().empty())
autocheckout_manager_.OnLoadedPageMetaData(page_meta_data.Pass()); autocheckout_manager_.OnLoadedPageMetaData(page_meta_data.Pass());
// If the corresponding flag is set, annotate forms with the predicted types. // If the corresponding flag is set, annotate forms with the predicted types.
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
#include "base/metrics/field_trial.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "components/autofill/common/autofill_switches.h" #include "components/autofill/common/autofill_switches.h"
...@@ -75,14 +76,18 @@ bool IsAutofillableElement(const WebFormControlElement& element) { ...@@ -75,14 +76,18 @@ bool IsAutofillableElement(const WebFormControlElement& element) {
return IsAutofillableInputElement(input_element) || IsSelectElement(element); return IsAutofillableInputElement(input_element) || IsSelectElement(element);
} }
bool IsAutocheckoutEnabled() {
return base::FieldTrialList::FindFullName("Autocheckout") == "Yes" ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalFormFilling);
}
// Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement. // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement.
// When Autocheckout is enabled, this requirement is enforced in the browser // When Autocheckout is enabled, this requirement is enforced in the browser
// process rather than in the renderer process, and hence all fields are // process rather than in the renderer process, and hence all fields are
// considered to satisfy this requirement. // considered to satisfy this requirement.
bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) {
return input_element.autoComplete() || return input_element.autoComplete() || IsAutocheckoutEnabled();
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalFormFilling);
} }
// Appends |suffix| to |prefix| so that any intermediary whitespace is collapsed // Appends |suffix| to |prefix| so that any intermediary whitespace is collapsed
......
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