| Index: chrome/browser/autofill/form_structure.cc
|
| ===================================================================
|
| --- chrome/browser/autofill/form_structure.cc (revision 66219)
|
| +++ chrome/browser/autofill/form_structure.cc (working copy)
|
| @@ -107,7 +107,7 @@
|
| std::string* encoded_xml) const {
|
| DCHECK(encoded_xml);
|
| encoded_xml->clear();
|
| - bool auto_fillable = IsAutoFillable(false);
|
| + bool auto_fillable = IsAutoFillable();
|
| DCHECK(auto_fillable); // Caller should've checked for search pages.
|
| if (!auto_fillable)
|
| return false;
|
| @@ -232,6 +232,8 @@
|
|
|
| form->UpdateAutoFillCount();
|
| }
|
| +
|
| + return;
|
| }
|
|
|
| std::string FormStructure::FormSignature() const {
|
| @@ -245,11 +247,11 @@
|
| return Hash64Bit(form_string);
|
| }
|
|
|
| -bool FormStructure::IsAutoFillable(bool require_method_post) const {
|
| +bool FormStructure::IsAutoFillable() const {
|
| if (autofill_count() < kRequiredFillableFields)
|
| return false;
|
|
|
| - return ShouldBeParsed(require_method_post);
|
| + return ShouldBeParsed();
|
| }
|
|
|
| bool FormStructure::HasAutoFillableValues() const {
|
| @@ -266,6 +268,46 @@
|
| return false;
|
| }
|
|
|
| +// TODO(jhawkins): Cache this result.
|
| +bool FormStructure::HasBillingFields() const {
|
| + for (std::vector<AutoFillField*>::const_iterator iter = begin();
|
| + iter != end(); ++iter) {
|
| + if (!*iter)
|
| + return false;
|
| +
|
| + AutoFillField* field = *iter;
|
| + if (!field)
|
| + continue;
|
| +
|
| + AutoFillType type(field->type());
|
| + if (type.group() == AutoFillType::ADDRESS_BILLING ||
|
| + type.group() == AutoFillType::CREDIT_CARD)
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| +// TODO(jhawkins): Cache this result.
|
| +bool FormStructure::HasNonBillingFields() const {
|
| + for (std::vector<AutoFillField*>::const_iterator iter = begin();
|
| + iter != end(); ++iter) {
|
| + if (!*iter)
|
| + return false;
|
| +
|
| + AutoFillField* field = *iter;
|
| + if (!field)
|
| + continue;
|
| +
|
| + AutoFillType type(field->type());
|
| + if (type.group() != AutoFillType::ADDRESS_BILLING &&
|
| + type.group() != AutoFillType::CREDIT_CARD)
|
| + return true;
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| void FormStructure::UpdateAutoFillCount() {
|
| autofill_count_ = 0;
|
| for (std::vector<AutoFillField*>::const_iterator iter = begin();
|
| @@ -276,7 +318,7 @@
|
| }
|
| }
|
|
|
| -bool FormStructure::ShouldBeParsed(bool require_method_post) const {
|
| +bool FormStructure::ShouldBeParsed() const {
|
| if (field_count() < kRequiredFillableFields)
|
| return false;
|
|
|
| @@ -286,7 +328,10 @@
|
| if (target_url_.path() == "/search")
|
| return false;
|
|
|
| - return !require_method_post || (method_ == POST);
|
| + if (method_ == GET)
|
| + return false;
|
| +
|
| + return true;
|
| }
|
|
|
| void FormStructure::set_possible_types(int index, const FieldTypeSet& types) {
|
|
|