| Index: chrome/browser/autofill/form_structure.cc
|
| diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
|
| index 39cdf5f838cac4dbdeadb9026d3ef25c7e929824..4174bbf5f20facb714cdabcc706e1da30ee75e81 100644
|
| --- a/chrome/browser/autofill/form_structure.cc
|
| +++ b/chrome/browser/autofill/form_structure.cc
|
| @@ -40,7 +40,9 @@ const char kAttributeClientVersion[] = "clientversion";
|
| const char kAttributeDataPresent[] = "datapresent";
|
| const char kAttributeFormSignature[] = "formsignature";
|
| const char kAttributeSignature[] = "signature";
|
| -const char kAcceptedFeatures[] = "e"; // e=experiments
|
| +const char kAttributeUrlprefix[] = "urlprefix";
|
| +const char kAcceptedFeatureExperiment[] = "e"; // e=experiments
|
| +const char kAcceptedFeatureAutocheckout[] = "a"; // a=autocheckout
|
| const char kClientVersion[] = "6.1.1715.1442/en (GGLL)";
|
| const char kXMLDeclaration[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
| const char kXMLElementAutofillQuery[] = "autofillquery";
|
| @@ -375,9 +377,8 @@ bool FormStructure::EncodeQueryRequest(
|
| (buzz::QName(kXMLElementAutofillQuery)));
|
| autofill_request_xml.SetAttr(buzz::QName(kAttributeClientVersion),
|
| kClientVersion);
|
| - autofill_request_xml.SetAttr(buzz::QName(kAttributeAcceptedFeatures),
|
| - kAcceptedFeatures);
|
|
|
| + std::string autocheckout_urlprefix;
|
| // Some badly formatted web sites repeat forms - detect that and encode only
|
| // one form as returned data would be the same for all the repeated forms.
|
| std::set<std::string> processed_forms;
|
| @@ -397,6 +398,13 @@ bool FormStructure::EncodeQueryRequest(
|
| encompassing_xml_element.get()))
|
| continue; // Malformed form, skip it.
|
|
|
| + if ((*it)->autocheckout_enabled_ && autocheckout_urlprefix.empty()) {
|
| + GURL::Replacements replacements;
|
| + replacements.ClearQuery();
|
| + autocheckout_urlprefix = (*it)->source_url()
|
| + .ReplaceComponents(replacements).spec();
|
| + }
|
| +
|
| autofill_request_xml.AddElement(encompassing_xml_element.release());
|
| encoded_signatures->push_back(signature);
|
| }
|
| @@ -404,6 +412,16 @@ bool FormStructure::EncodeQueryRequest(
|
| if (!encoded_signatures->size())
|
| return false;
|
|
|
| + if (autocheckout_urlprefix.empty()) {
|
| + autofill_request_xml.SetAttr(buzz::QName(kAttributeAcceptedFeatures),
|
| + kAcceptedFeatureExperiment);
|
| + } else {
|
| + autofill_request_xml.SetAttr(buzz::QName(kAttributeAcceptedFeatures),
|
| + kAcceptedFeatureAutocheckout);
|
| + autofill_request_xml.SetAttr(buzz::QName(kAttributeUrlprefix),
|
| + autocheckout_urlprefix);
|
| + }
|
| +
|
| // Obtain the XML structure as a string.
|
| *encoded_xml = kXMLDeclaration;
|
| *encoded_xml += autofill_request_xml.Str().c_str();
|
|
|