summaryrefslogtreecommitdiffstats
path: root/components/autofill
diff options
context:
space:
mode:
authorramankk@chromium.org <ramankk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 04:52:33 +0000
committerramankk@chromium.org <ramankk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-18 04:52:33 +0000
commit32290f62441f87ece1b837e2de2591bb7cb8ab2e (patch)
tree3dba33d3d0bd2f3af854c97cf3f96e63257a2e5b /components/autofill
parent0248d9208d15bb5d7ae5bb482740e90ee62c8b2a (diff)
downloadchromium_src-32290f62441f87ece1b837e2de2591bb7cb8ab2e.zip
chromium_src-32290f62441f87ece1b837e2de2591bb7cb8ab2e.tar.gz
chromium_src-32290f62441f87ece1b837e2de2591bb7cb8ab2e.tar.bz2
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
Diffstat (limited to 'components/autofill')
-rw-r--r--components/autofill/browser/autocheckout/whitelist_manager.cc4
-rw-r--r--components/autofill/browser/autofill_manager.cc3
-rw-r--r--components/autofill/renderer/form_autofill_util.cc11
3 files changed, 13 insertions, 5 deletions
diff --git a/components/autofill/browser/autocheckout/whitelist_manager.cc b/components/autofill/browser/autocheckout/whitelist_manager.cc
index aeb60f1..ed735b6 100644
--- a/components/autofill/browser/autocheckout/whitelist_manager.cc
+++ b/components/autofill/browser/autocheckout/whitelist_manager.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/field_trial.h"
#include "base/string_util.h"
#include "base/strings/string_split.h"
#include "components/autofill/common/autofill_switches.h"
@@ -41,7 +42,8 @@ WhitelistManager::WhitelistManager()
: callback_is_pending_(false),
experimental_form_filling_enabled_(
CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalFormFilling)),
+ switches::kEnableExperimentalFormFilling) ||
+ base::FieldTrialList::FindFullName("Autocheckout") == "Yes"),
bypass_autocheckout_whitelist_(
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kBypassAutocheckoutWhitelist)) {
diff --git a/components/autofill/browser/autofill_manager.cc b/components/autofill/browser/autofill_manager.cc
index ceaf77c..ceecddb 100644
--- a/components/autofill/browser/autofill_manager.cc
+++ b/components/autofill/browser/autofill_manager.cc
@@ -879,7 +879,8 @@ void AutofillManager::OnLoadedServerPredictions(
page_meta_data.get(),
*metric_logger_);
- autocheckout_manager_.OnLoadedPageMetaData(page_meta_data.Pass());
+ if (!GetAutocheckoutURLPrefix().empty())
+ autocheckout_manager_.OnLoadedPageMetaData(page_meta_data.Pass());
// If the corresponding flag is set, annotate forms with the predicted types.
SendAutofillTypePredictions(form_structures_.get());
diff --git a/components/autofill/renderer/form_autofill_util.cc b/components/autofill/renderer/form_autofill_util.cc
index 64e2f81..b92175f 100644
--- a/components/autofill/renderer/form_autofill_util.cc
+++ b/components/autofill/renderer/form_autofill_util.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/scoped_vector.h"
+#include "base/metrics/field_trial.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "components/autofill/common/autofill_switches.h"
@@ -75,14 +76,18 @@ bool IsAutofillableElement(const WebFormControlElement& 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.
// When Autocheckout is enabled, this requirement is enforced in the browser
// process rather than in the renderer process, and hence all fields are
// considered to satisfy this requirement.
bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) {
- return input_element.autoComplete() ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalFormFilling);
+ return input_element.autoComplete() || IsAutocheckoutEnabled();
}
// Appends |suffix| to |prefix| so that any intermediary whitespace is collapsed