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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 void FormStructure::GetHeuristicAutoFillTypes() { | 372 void FormStructure::GetHeuristicAutoFillTypes() { |
373 has_credit_card_field_ = false; | 373 has_credit_card_field_ = false; |
374 has_autofillable_field_ = false; | 374 has_autofillable_field_ = false; |
375 | 375 |
376 FieldTypeMap field_type_map; | 376 FieldTypeMap field_type_map; |
377 GetHeuristicFieldInfo(&field_type_map); | 377 GetHeuristicFieldInfo(&field_type_map); |
378 | 378 |
379 for (size_t index = 0; index < field_count(); index++) { | 379 for (size_t index = 0; index < field_count(); index++) { |
380 AutoFillField* field = fields_[index]; | 380 AutoFillField* field = fields_[index]; |
381 // TODO(dhollowa): Defensive check for crash happening in the field. | 381 DCHECK(field); |
382 // See http://crbug.com/42211 | |
383 CHECK(field); | |
384 FieldTypeMap::iterator iter = field_type_map.find(field->unique_name()); | 382 FieldTypeMap::iterator iter = field_type_map.find(field->unique_name()); |
385 | 383 |
386 AutoFillFieldType heuristic_auto_fill_type; | 384 AutoFillFieldType heuristic_auto_fill_type; |
387 if (iter == field_type_map.end()) { | 385 if (iter == field_type_map.end()) { |
388 heuristic_auto_fill_type = UNKNOWN_TYPE; | 386 heuristic_auto_fill_type = UNKNOWN_TYPE; |
389 } else { | 387 } else { |
390 heuristic_auto_fill_type = iter->second; | 388 heuristic_auto_fill_type = iter->second; |
391 ++autofill_count_; | 389 ++autofill_count_; |
392 } | 390 } |
393 | 391 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } else { | 433 } else { |
436 buzz::XmlElement *field_element = new buzz::XmlElement( | 434 buzz::XmlElement *field_element = new buzz::XmlElement( |
437 buzz::QName(kXMLElementField)); | 435 buzz::QName(kXMLElementField)); |
438 field_element->SetAttr(buzz::QName(kAttributeSignature), | 436 field_element->SetAttr(buzz::QName(kAttributeSignature), |
439 field->FieldSignature()); | 437 field->FieldSignature()); |
440 encompassing_xml_element->AddElement(field_element); | 438 encompassing_xml_element->AddElement(field_element); |
441 } | 439 } |
442 } | 440 } |
443 return true; | 441 return true; |
444 } | 442 } |
OLD | NEW |