| 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 "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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 has_autofillable_field_(false), | 51 has_autofillable_field_(false), |
| 52 has_password_fields_(false), | 52 has_password_fields_(false), |
| 53 autofill_count_(0) { | 53 autofill_count_(0) { |
| 54 // Copy the form fields. | 54 // Copy the form fields. |
| 55 std::vector<webkit_glue::FormField>::const_iterator field; | 55 std::vector<webkit_glue::FormField>::const_iterator field; |
| 56 for (field = form.fields.begin(); | 56 for (field = form.fields.begin(); |
| 57 field != form.fields.end(); field++) { | 57 field != form.fields.end(); field++) { |
| 58 // Add all supported form fields (including with empty names) to the | 58 // Add all supported form fields (including with empty names) to the |
| 59 // signature. This is a requirement for AutoFill servers. | 59 // signature. This is a requirement for AutoFill servers. |
| 60 form_signature_field_names_.append("&"); | 60 form_signature_field_names_.append("&"); |
| 61 form_signature_field_names_.append(UTF16ToUTF8(field->name())); | 61 form_signature_field_names_.append(UTF16ToUTF8(field->name)); |
| 62 | 62 |
| 63 // Generate a unique name for this field by appending a counter to the name. | 63 // Generate a unique name for this field by appending a counter to the name. |
| 64 string16 unique_name = field->name() + | 64 string16 unique_name = field->name + |
| 65 base::IntToString16(fields_.size() + 1); | 65 base::IntToString16(fields_.size() + 1); |
| 66 fields_.push_back(new AutofillField(*field, unique_name)); | 66 fields_.push_back(new AutofillField(*field, unique_name)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Terminate the vector with a NULL item. | 69 // Terminate the vector with a NULL item. |
| 70 fields_.push_back(NULL); | 70 fields_.push_back(NULL); |
| 71 GetHeuristicAutofillTypes(); | 71 GetHeuristicAutofillTypes(); |
| 72 | 72 |
| 73 std::string method = UTF16ToUTF8(form.method); | 73 std::string method = UTF16ToUTF8(form.method); |
| 74 if (StringToLowerASCII(method) == kFormMethodPost) { | 74 if (StringToLowerASCII(method) == kFormMethodPost) { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 | 472 |
| 473 // Print all meaningfull bytes into the string. | 473 // Print all meaningfull bytes into the string. |
| 474 for (size_t i = 0; i < data_end; ++i) { | 474 for (size_t i = 0; i < data_end; ++i) { |
| 475 base::StringAppendF(&data_presence, "%02x", presence_bitfield[i]); | 475 base::StringAppendF(&data_presence, "%02x", presence_bitfield[i]); |
| 476 } | 476 } |
| 477 | 477 |
| 478 return data_presence; | 478 return data_presence; |
| 479 } | 479 } |
| 480 | 480 |
| OLD | NEW |