Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1058)

Unified Diff: chrome/browser/autofill/form_structure.cc

Issue 12089035: add experiment support and add urlprefix for autocheckout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/autofill/form_structure_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | chrome/browser/autofill/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698