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/select_control_handler.h" | 5 #include "chrome/browser/autofill/select_control_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 478 } |
479 | 479 |
480 } // namespace | 480 } // namespace |
481 | 481 |
482 namespace autofill { | 482 namespace autofill { |
483 | 483 |
484 void FillSelectControl(const FormGroup& form_group, | 484 void FillSelectControl(const FormGroup& form_group, |
485 AutoFillType type, | 485 AutoFillType type, |
486 webkit_glue::FormField* field) { | 486 webkit_glue::FormField* field) { |
487 DCHECK(field); | 487 DCHECK(field); |
488 DCHECK(field->form_control_type() == ASCIIToUTF16("select-one")); | 488 DCHECK_EQ(field->form_control_type(), ASCIIToUTF16("select-one")); |
489 | 489 |
490 string16 value; | 490 string16 value; |
491 string16 field_text = form_group.GetFieldText(type); | 491 string16 field_text = form_group.GetFieldText(type); |
492 for (size_t i = 0; i < field->option_strings().size(); ++i) { | 492 for (size_t i = 0; i < field->option_strings().size(); ++i) { |
493 if (field_text == field->option_strings()[i]) { | 493 if (field_text == field->option_strings()[i]) { |
494 // An exact match, use it. | 494 // An exact match, use it. |
495 value = field_text; | 495 value = field_text; |
496 break; | 496 break; |
497 } | 497 } |
498 | 498 |
(...skipping 17 matching lines...) Expand all Loading... |
516 type.field_type() == ADDRESS_BILLING_COUNTRY) { | 516 type.field_type() == ADDRESS_BILLING_COUNTRY) { |
517 FillCountrySelectControl(field_text, field); | 517 FillCountrySelectControl(field_text, field); |
518 } else if (type.field_type() == CREDIT_CARD_EXP_MONTH) { | 518 } else if (type.field_type() == CREDIT_CARD_EXP_MONTH) { |
519 FillExpirationMonthSelectControl(field_text, field); | 519 FillExpirationMonthSelectControl(field_text, field); |
520 } | 520 } |
521 | 521 |
522 return; | 522 return; |
523 } | 523 } |
524 | 524 |
525 } // namespace autofill | 525 } // namespace autofill |
OLD | NEW |