| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_data_model.h" | 5 #include "components/autofill/core/browser/autofill_data_model.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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // not found. | 151 // not found. |
| 152 value = field->option_values[i]; | 152 value = field->option_values[i]; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 if (!value.empty()) { | 156 if (!value.empty()) { |
| 157 field->value = value; | 157 field->value = value; |
| 158 return; | 158 return; |
| 159 } | 159 } |
| 160 | 160 |
| 161 NativeFieldType native_type = type.native_type(); | 161 NativeFieldType native_type = type.GetEquivalentNativeType(); |
| 162 if (native_type == ADDRESS_HOME_STATE || | 162 if (native_type == ADDRESS_HOME_STATE) { |
| 163 native_type == ADDRESS_BILLING_STATE) { | |
| 164 FillStateSelectControl(field_text, field); | 163 FillStateSelectControl(field_text, field); |
| 165 } else if (native_type == ADDRESS_HOME_COUNTRY || | 164 } else if (native_type == ADDRESS_HOME_COUNTRY) { |
| 166 native_type == ADDRESS_BILLING_COUNTRY) { | |
| 167 FillCountrySelectControl(app_locale, field); | 165 FillCountrySelectControl(app_locale, field); |
| 168 } else if (native_type == CREDIT_CARD_EXP_MONTH) { | 166 } else if (native_type == CREDIT_CARD_EXP_MONTH) { |
| 169 FillExpirationMonthSelectControl(field_text, field); | 167 FillExpirationMonthSelectControl(field_text, field); |
| 170 } else if (native_type == CREDIT_CARD_EXP_4_DIGIT_YEAR) { | 168 } else if (native_type == CREDIT_CARD_EXP_4_DIGIT_YEAR) { |
| 171 // Attempt to fill the year as a 2-digit year. This compensates for the | 169 // Attempt to fill the year as a 2-digit year. This compensates for the |
| 172 // fact that our heuristics do not always correctly detect when a website | 170 // fact that our heuristics do not always correctly detect when a website |
| 173 // requests a 2-digit rather than a 4-digit year. | 171 // requests a 2-digit rather than a 4-digit year. |
| 174 FillSelectControl(AutofillType(CREDIT_CARD_EXP_2_DIGIT_YEAR), app_locale, | 172 FillSelectControl(AutofillType(CREDIT_CARD_EXP_2_DIGIT_YEAR), app_locale, |
| 175 field); | 173 field); |
| 176 } else if (native_type == CREDIT_CARD_TYPE) { | 174 } else if (native_type == CREDIT_CARD_TYPE) { |
| 177 FillCreditCardTypeSelectControl(field_text, field); | 175 FillCreditCardTypeSelectControl(field_text, field); |
| 178 } | 176 } |
| 179 } | 177 } |
| 180 | 178 |
| 181 bool AutofillDataModel::FillCountrySelectControl( | 179 bool AutofillDataModel::FillCountrySelectControl( |
| 182 const std::string& app_locale, | 180 const std::string& app_locale, |
| 183 FormFieldData* field_data) const { | 181 FormFieldData* field_data) const { |
| 184 return false; | 182 return false; |
| 185 } | 183 } |
| 186 | 184 |
| 187 bool AutofillDataModel::IsVerified() const { | 185 bool AutofillDataModel::IsVerified() const { |
| 188 return !origin_.empty() && !GURL(origin_).is_valid(); | 186 return !origin_.empty() && !GURL(origin_).is_valid(); |
| 189 } | 187 } |
| 190 | 188 |
| 191 } // namespace autofill | 189 } // namespace autofill |
| OLD | NEW |