| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autofill/form_structure.h" | 5 #include "chrome/browser/autofill/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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 EncodeFieldTypes(available_field_types).c_str()); | 348 EncodeFieldTypes(available_field_types).c_str()); |
| 349 | 349 |
| 350 if (!EncodeFormRequest(FormStructure::UPLOAD, &autofill_request_xml)) | 350 if (!EncodeFormRequest(FormStructure::UPLOAD, &autofill_request_xml)) |
| 351 return false; // Malformed form, skip it. | 351 return false; // Malformed form, skip it. |
| 352 | 352 |
| 353 // Obtain the XML structure as a string. | 353 // Obtain the XML structure as a string. |
| 354 encoded_xml->clear(); | 354 encoded_xml->clear(); |
| 355 *encoded_xml = kXMLDeclaration; | 355 *encoded_xml = kXMLDeclaration; |
| 356 *encoded_xml += autofill_request_xml.Str().c_str(); | 356 *encoded_xml += autofill_request_xml.Str().c_str(); |
| 357 | 357 |
| 358 // To enable this logging, run with the flag --vmodule="form_structure=2". |
| 359 VLOG(2) << "\n" << *encoded_xml; |
| 360 |
| 358 return true; | 361 return true; |
| 359 } | 362 } |
| 360 | 363 |
| 361 // static | 364 // static |
| 362 bool FormStructure::EncodeQueryRequest( | 365 bool FormStructure::EncodeQueryRequest( |
| 363 const ScopedVector<FormStructure>& forms, | 366 const ScopedVector<FormStructure>& forms, |
| 364 std::vector<std::string>* encoded_signatures, | 367 std::vector<std::string>* encoded_signatures, |
| 365 std::string* encoded_xml) { | 368 std::string* encoded_xml) { |
| 366 DCHECK(encoded_signatures); | 369 DCHECK(encoded_signatures); |
| 367 DCHECK(encoded_xml); | 370 DCHECK(encoded_xml); |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 if (current_type != UNKNOWN_TYPE && already_saw_current_type) { | 963 if (current_type != UNKNOWN_TYPE && already_saw_current_type) { |
| 961 // We reached the end of a section, so start a new section. | 964 // We reached the end of a section, so start a new section. |
| 962 seen_types.clear(); | 965 seen_types.clear(); |
| 963 current_section = (*field)->unique_name(); | 966 current_section = (*field)->unique_name(); |
| 964 } | 967 } |
| 965 | 968 |
| 966 seen_types.insert(current_type); | 969 seen_types.insert(current_type); |
| 967 (*field)->set_section(current_section); | 970 (*field)->set_section(current_section); |
| 968 } | 971 } |
| 969 } | 972 } |
| OLD | NEW |