| Index: chrome/browser/autofill/form_structure.cc
|
| diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
|
| index 28d3535c9abe6894a5ff038d12cf2a453fd61319..39cdf5f838cac4dbdeadb9026d3ef25c7e929824 100644
|
| --- a/chrome/browser/autofill/form_structure.cc
|
| +++ b/chrome/browser/autofill/form_structure.cc
|
| @@ -222,7 +222,7 @@ AutofillFieldType FieldTypeFromAutocompleteType(
|
|
|
| } // namespace
|
|
|
| -FormStructure::FormStructure(const FormData& form)
|
| +FormStructure::FormStructure(const FormData& form, bool autocheckout_enabled)
|
| : form_name_(form.name),
|
| source_url_(form.origin),
|
| target_url_(form.action),
|
| @@ -233,18 +233,16 @@ FormStructure::FormStructure(const FormData& form)
|
| current_page_number_(-1),
|
| total_pages_(-1),
|
| has_author_specified_types_(false),
|
| - experimental_form_filling_enabled_(
|
| - CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableExperimentalFormFilling)) {
|
| + autocheckout_enabled_(autocheckout_enabled) {
|
| // Copy the form fields.
|
| std::map<string16, size_t> unique_names;
|
| for (std::vector<FormFieldData>::const_iterator field =
|
| form.fields.begin();
|
| field != form.fields.end(); field++) {
|
| - // Skipping checkable elements when flag is not set, else these fields will
|
| - // interfere with existing field signatures with Autofill servers.
|
| - // TODO(ramankk): Add checkable elements only on whitelisted pages
|
| - if (!field->is_checkable || experimental_form_filling_enabled_) {
|
| + // Skipping checkable elements when autocheckout is not enabled, else
|
| + // these fields will interfere with existing field signatures with Autofill
|
| + // servers.
|
| + if (!field->is_checkable || autocheckout_enabled_) {
|
| // Add all supported form fields (including with empty names) to the
|
| // signature. This is a requirement for Autofill servers.
|
| form_signature_field_names_.append("&");
|
| @@ -547,13 +545,12 @@ std::string FormStructure::FormSignature() const {
|
| return Hash64Bit(form_string);
|
| }
|
|
|
| -bool FormStructure::IsAutofillable(bool require_method_post) const {
|
| - // TODO(ramankk): Remove this check once we have better way of identifying the
|
| - // cases to trigger experimental form filling.
|
| - if (experimental_form_filling_enabled_)
|
| - return true;
|
| +size_t FormStructure::RequiredFillableFields() const {
|
| + return autocheckout_enabled_? 0 : kRequiredFillableFields;
|
| +}
|
|
|
| - if (autofill_count() < kRequiredFillableFields)
|
| +bool FormStructure::IsAutofillable(bool require_method_post) const {
|
| + if (autofill_count() < RequiredFillableFields())
|
| return false;
|
|
|
| return ShouldBeParsed(require_method_post);
|
| @@ -570,15 +567,10 @@ void FormStructure::UpdateAutofillCount() {
|
| }
|
|
|
| bool FormStructure::ShouldBeParsed(bool require_method_post) const {
|
| - // TODO(ramankk): Remove this check once we have better way of identifying the
|
| - // cases to trigger experimental form filling.
|
| - if (experimental_form_filling_enabled_)
|
| - return true;
|
| -
|
| // Ignore counting checkable elements towards minimum number of elements
|
| // required to parse. This avoids trying to crowdsource forms with few text
|
| // or select elements.
|
| - if ((field_count() - checkable_field_count()) < kRequiredFillableFields)
|
| + if ((field_count() - checkable_field_count()) < RequiredFillableFields())
|
| return false;
|
|
|
| // Rule out http(s)://*/search?...
|
| @@ -776,7 +768,7 @@ void FormStructure::LogQualityMetrics(
|
| }
|
| }
|
|
|
| - if (num_detected_field_types < kRequiredFillableFields) {
|
| + if (num_detected_field_types < RequiredFillableFields()) {
|
| metric_logger.LogUserHappinessMetric(
|
| AutofillMetrics::SUBMITTED_NON_FILLABLE_FORM);
|
| } else {
|
| @@ -933,8 +925,9 @@ bool FormStructure::EncodeFormRequest(
|
| encompassing_xml_element->AddElement(field_element);
|
| }
|
| } else {
|
| - // Skip putting checkable fields in the request if the flag is not set.
|
| - if (field->is_checkable && !experimental_form_filling_enabled_)
|
| + // Skip putting checkable fields in the request if autocheckout is not
|
| + // enabled.
|
| + if (field->is_checkable && !autocheckout_enabled_)
|
| continue;
|
|
|
| buzz::XmlElement *field_element = new buzz::XmlElement(
|
|
|