Index: chrome/browser/autofill/form_structure.cc |
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc |
index 370ac2ab70a8526324714a1a62495e88b1bcdf67..d9e9499388d05da6399c7079cae6184194a82760 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"; |
@@ -392,9 +394,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; |
@@ -414,6 +415,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); |
} |
@@ -421,6 +429,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); |
Ilya Sherman
2013/01/25 20:37:35
Shouldn't we support both experiments and autochec
benquan
2013/01/29 00:36:09
We use a different form_data in server side, when
Ilya Sherman
2013/01/29 01:49:23
That sounds like something that should be controll
benquan
2013/01/30 19:24:22
Basically autocheckout and experiments are exclusi
Ilya Sherman
2013/01/30 21:12:14
What in the client code makes them necessarily exc
benquan
2013/01/31 03:58:05
Done.
|
+ autofill_request_xml.SetAttr(buzz::QName(kAttributeUrlprefix), |
+ autocheckout_urlprefix); |
Ilya Sherman
2013/01/25 20:37:35
What does this attribute accomplish? Why do we on
benquan
2013/01/29 00:36:09
urlprefix tells autofillserver where the forms in
Ilya Sherman
2013/01/29 01:49:23
Ok, that makes some sense -- thanks for the explan
benquan
2013/01/30 19:24:22
The query string is stripped, and we only send thi
Ilya Sherman
2013/01/30 21:12:14
Why not? If the server knows the URL, it can comp
benquan
2013/01/31 03:58:05
Changed to pass down hash code of the url prefix i
|
+ } |
+ |
// Obtain the XML structure as a string. |
*encoded_xml = kXMLDeclaration; |
*encoded_xml += autofill_request_xml.Str().c_str(); |