OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 } else { | 98 } else { |
99 // Either the method is 'get', or we don't know. In this case we default | 99 // Either the method is 'get', or we don't know. In this case we default |
100 // to GET. | 100 // to GET. |
101 method_ = GET; | 101 method_ = GET; |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 FormStructure::~FormStructure() {} | 105 FormStructure::~FormStructure() {} |
106 | 106 |
107 bool FormStructure::EncodeUploadRequest(bool auto_fill_used, | 107 bool FormStructure::EncodeUploadRequest(bool auto_fill_used, |
108 char const* present_data, | |
108 std::string* encoded_xml) const { | 109 std::string* encoded_xml) const { |
109 DCHECK(encoded_xml); | 110 DCHECK(encoded_xml); |
110 encoded_xml->clear(); | 111 encoded_xml->clear(); |
111 bool auto_fillable = IsAutoFillable(false); | 112 bool auto_fillable = IsAutoFillable(false); |
112 DCHECK(auto_fillable); // Caller should've checked for search pages. | 113 DCHECK(auto_fillable); // Caller should've checked for search pages. |
113 if (!auto_fillable) | 114 if (!auto_fillable) |
114 return false; | 115 return false; |
115 | 116 |
116 buzz::XmlElement autofil_request_xml(buzz::QName("autofillupload")); | 117 buzz::XmlElement autofil_request_xml(buzz::QName("autofillupload")); |
dhollowa
2011/01/14 18:40:58
s/autofil_request_xml/autofill_request_xml/
GeorgeY
2011/01/18 21:04:56
Done.
| |
117 | 118 |
118 // Attributes for the <autofillupload> element. | 119 // Attributes for the <autofillupload> element. |
119 // | 120 // |
120 // TODO(jhawkins): Work with toolbar devs to make a spec for autofill clients. | 121 // TODO(jhawkins): Work with toolbar devs to make a spec for autofill clients. |
121 // For now these values are hacked from the toolbar code. | 122 // For now these values are hacked from the toolbar code. |
122 autofil_request_xml.SetAttr(buzz::QName(kAttributeClientVersion), | 123 autofil_request_xml.SetAttr(buzz::QName(kAttributeClientVersion), |
123 "6.1.1715.1442/en (GGLL)"); | 124 "6.1.1715.1442/en (GGLL)"); |
124 | 125 |
125 autofil_request_xml.SetAttr(buzz::QName(kAttributeFormSignature), | 126 autofil_request_xml.SetAttr(buzz::QName(kAttributeFormSignature), |
126 FormSignature()); | 127 FormSignature()); |
127 | 128 |
128 autofil_request_xml.SetAttr(buzz::QName(kAttributeAutoFillUsed), | 129 autofil_request_xml.SetAttr(buzz::QName(kAttributeAutoFillUsed), |
129 auto_fill_used ? "true" : "false"); | 130 auto_fill_used ? "true" : "false"); |
130 | 131 |
131 // TODO(jhawkins): Hook this up to the personal data manager. | 132 autofil_request_xml.SetAttr(buzz::QName(kAttributeDataPresent), |
132 // personaldata_manager_->GetDataPresent(); | 133 present_data); |
133 autofil_request_xml.SetAttr(buzz::QName(kAttributeDataPresent), ""); | |
134 | 134 |
135 if (!EncodeFormRequest(FormStructure::UPLOAD, &autofil_request_xml)) | 135 if (!EncodeFormRequest(FormStructure::UPLOAD, &autofil_request_xml)) |
136 return false; // Malformed form, skip it. | 136 return false; // Malformed form, skip it. |
137 | 137 |
138 // Obtain the XML structure as a string. | 138 // Obtain the XML structure as a string. |
139 *encoded_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; | 139 *encoded_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; |
140 *encoded_xml += autofil_request_xml.Str().c_str(); | 140 *encoded_xml += autofil_request_xml.Str().c_str(); |
141 | 141 |
142 return true; | 142 return true; |
143 } | 143 } |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 } else { | 427 } else { |
428 buzz::XmlElement *field_element = new buzz::XmlElement( | 428 buzz::XmlElement *field_element = new buzz::XmlElement( |
429 buzz::QName(kXMLElementField)); | 429 buzz::QName(kXMLElementField)); |
430 field_element->SetAttr(buzz::QName(kAttributeSignature), | 430 field_element->SetAttr(buzz::QName(kAttributeSignature), |
431 field->FieldSignature()); | 431 field->FieldSignature()); |
432 encompassing_xml_element->AddElement(field_element); | 432 encompassing_xml_element->AddElement(field_element); |
433 } | 433 } |
434 } | 434 } |
435 return true; | 435 return true; |
436 } | 436 } |
OLD | NEW |