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

Side by Side Diff: components/autofill/core/browser/form_structure.cc

Issue 1422853003: [Autofill] Send the form name in Autofill uploads where metadata is collected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/form_structure.h" 5 #include "components/autofill/core/browser/form_structure.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 29 matching lines...) Expand all
40 // XML elements and attributes. 40 // XML elements and attributes.
41 const char kAttributeAutofillUsed[] = "autofillused"; 41 const char kAttributeAutofillUsed[] = "autofillused";
42 const char kAttributeAutofillType[] = "autofilltype"; 42 const char kAttributeAutofillType[] = "autofilltype";
43 const char kAttributeClientVersion[] = "clientversion"; 43 const char kAttributeClientVersion[] = "clientversion";
44 const char kAttributeDataPresent[] = "datapresent"; 44 const char kAttributeDataPresent[] = "datapresent";
45 const char kAttributeFieldID[] = "fieldid"; 45 const char kAttributeFieldID[] = "fieldid";
46 const char kAttributeFieldType[] = "fieldtype"; 46 const char kAttributeFieldType[] = "fieldtype";
47 const char kAttributeFieldLabel[] = "label"; 47 const char kAttributeFieldLabel[] = "label";
48 const char kAttributeFormSignature[] = "formsignature"; 48 const char kAttributeFormSignature[] = "formsignature";
49 const char kAttributeFormActionHostSignature[] = "actionsignature"; 49 const char kAttributeFormActionHostSignature[] = "actionsignature";
50 const char kAttributeFormName[] = "formname";
50 const char kAttributeName[] = "name"; 51 const char kAttributeName[] = "name";
51 const char kAttributeSignature[] = "signature"; 52 const char kAttributeSignature[] = "signature";
52 const char kAttributeControlType[] = "type"; 53 const char kAttributeControlType[] = "type";
53 const char kAttributeAutocomplete[] = "autocomplete"; 54 const char kAttributeAutocomplete[] = "autocomplete";
54 const char kAttributeLoginFormSignature[] = "loginformsignature"; 55 const char kAttributeLoginFormSignature[] = "loginformsignature";
55 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)"; 56 const char kClientVersion[] = "6.1.1715.1442/en (GGLL)";
56 const char kXMLDeclaration[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; 57 const char kXMLDeclaration[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
57 const char kXMLElementAutofillQuery[] = "autofillquery"; 58 const char kXMLElementAutofillQuery[] = "autofillquery";
58 const char kXMLElementAutofillUpload[] = "autofillupload"; 59 const char kXMLElementAutofillUpload[] = "autofillupload";
59 const char kXMLElementFieldAssignments[] = "fieldassignments"; 60 const char kXMLElementFieldAssignments[] = "fieldassignments";
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 kClientVersion); 478 kClientVersion);
478 autofill_request_xml.SetAttr(buzz::QName(kAttributeFormSignature), 479 autofill_request_xml.SetAttr(buzz::QName(kAttributeFormSignature),
479 FormSignature()); 480 FormSignature());
480 autofill_request_xml.SetAttr(buzz::QName(kAttributeAutofillUsed), 481 autofill_request_xml.SetAttr(buzz::QName(kAttributeAutofillUsed),
481 form_was_autofilled ? "true" : "false"); 482 form_was_autofilled ? "true" : "false");
482 autofill_request_xml.SetAttr(buzz::QName(kAttributeDataPresent), 483 autofill_request_xml.SetAttr(buzz::QName(kAttributeDataPresent),
483 EncodeFieldTypes(available_field_types).c_str()); 484 EncodeFieldTypes(available_field_types).c_str());
484 if (IsAutofillFieldMetadataEnabled()) { 485 if (IsAutofillFieldMetadataEnabled()) {
485 autofill_request_xml.SetAttr(buzz::QName(kAttributeFormActionHostSignature), 486 autofill_request_xml.SetAttr(buzz::QName(kAttributeFormActionHostSignature),
486 Hash64Bit(target_url_.host())); 487 Hash64Bit(target_url_.host()));
488 if(!form_name().empty()) {
489 autofill_request_xml.SetAttr(buzz::QName(kAttributeFormName),
490 base::UTF16ToUTF8(form_name()));
491 }
487 } 492 }
488 493
489 if (!login_form_signature.empty()) { 494 if (!login_form_signature.empty()) {
490 autofill_request_xml.SetAttr(buzz::QName(kAttributeLoginFormSignature), 495 autofill_request_xml.SetAttr(buzz::QName(kAttributeLoginFormSignature),
491 login_form_signature); 496 login_form_signature);
492 } 497 }
493 498
494 if (!EncodeFormRequest(FormStructure::UPLOAD, &autofill_request_xml)) 499 if (!EncodeFormRequest(FormStructure::UPLOAD, &autofill_request_xml))
495 return false; // Malformed form, skip it. 500 return false; // Malformed form, skip it.
496 501
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 for (AutofillField* field : fields_) { 1321 for (AutofillField* field : fields_) {
1317 FieldTypeGroup field_type_group = field->Type().group(); 1322 FieldTypeGroup field_type_group = field->Type().group();
1318 if (field_type_group == CREDIT_CARD) 1323 if (field_type_group == CREDIT_CARD)
1319 field->set_section(field->section() + "-cc"); 1324 field->set_section(field->section() + "-cc");
1320 else 1325 else
1321 field->set_section(field->section() + "-default"); 1326 field->set_section(field->section() + "-default");
1322 } 1327 }
1323 } 1328 }
1324 1329
1325 } // namespace autofill 1330 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_server_browsertest.cc ('k') | components/autofill/core/browser/form_structure_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698