| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace | 197 } // namespace |
| 198 | 198 |
| 199 namespace autofill { | 199 namespace autofill { |
| 200 | 200 |
| 201 void FillSelectControl(const FormGroup& form_group, | 201 void FillSelectControl(const FormGroup& form_group, |
| 202 AutofillFieldType type, | 202 AutofillFieldType type, |
| 203 FormFieldData* field) { | 203 FormFieldData* field) { |
| 204 DCHECK(field); | 204 DCHECK(field); |
| 205 DCHECK_EQ(ASCIIToUTF16("select-one"), field->form_control_type); | 205 DCHECK_EQ("select-one", field->form_control_type); |
| 206 DCHECK_EQ(field->option_values.size(), field->option_contents.size()); | 206 DCHECK_EQ(field->option_values.size(), field->option_contents.size()); |
| 207 | 207 |
| 208 string16 field_text = form_group.GetCanonicalizedInfo(type); | 208 string16 field_text = form_group.GetCanonicalizedInfo(type); |
| 209 string16 field_text_lower = StringToLowerASCII(field_text); | 209 string16 field_text_lower = StringToLowerASCII(field_text); |
| 210 if (field_text.empty()) | 210 if (field_text.empty()) |
| 211 return; | 211 return; |
| 212 | 212 |
| 213 string16 value; | 213 string16 value; |
| 214 for (size_t i = 0; i < field->option_values.size(); ++i) { | 214 for (size_t i = 0; i < field->option_values.size(); ++i) { |
| 215 if (field_text == field->option_values[i] || | 215 if (field_text == field->option_values[i] || |
| (...skipping 24 matching lines...) Expand all Loading... |
| 240 FillExpirationMonthSelectControl(field_text, field); | 240 FillExpirationMonthSelectControl(field_text, field); |
| 241 | 241 |
| 242 return; | 242 return; |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool IsValidState(const string16& value) { | 245 bool IsValidState(const string16& value) { |
| 246 return !State::Abbreviation(value).empty() || !State::FullName(value).empty(); | 246 return !State::Abbreviation(value).empty() || !State::FullName(value).empty(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace autofill | 249 } // namespace autofill |
| OLD | NEW |