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/address.h" | 5 #include "chrome/browser/autofill/address.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/autofill/autofill_type.h" | 9 #include "chrome/browser/autofill/autofill_type.h" |
10 #include "chrome/browser/autofill/field_types.h" | 10 #include "chrome/browser/autofill/field_types.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 return EmptyString16(); | 92 return EmptyString16(); |
93 } | 93 } |
94 | 94 |
95 void Address::SetInfo(const AutoFillType& type, const string16& value) { | 95 void Address::SetInfo(const AutoFillType& type, const string16& value) { |
96 FieldTypeSubGroup subgroup = type.subgroup(); | 96 FieldTypeSubGroup subgroup = type.subgroup(); |
97 if (subgroup == AutoFillType::ADDRESS_LINE1) | 97 if (subgroup == AutoFillType::ADDRESS_LINE1) |
98 set_line1(value); | 98 set_line1(value); |
99 else if (subgroup == AutoFillType::ADDRESS_LINE2) | 99 else if (subgroup == AutoFillType::ADDRESS_LINE2) |
100 set_line2(value); | 100 set_line2(value); |
101 else if (subgroup == AutoFillType::ADDRESS_APPT_NUM) | 101 else if (subgroup == AutoFillType::ADDRESS_APT_NUM) |
102 set_apt_num(value); | 102 set_apt_num(value); |
103 else if (subgroup == AutoFillType::ADDRESS_CITY) | 103 else if (subgroup == AutoFillType::ADDRESS_CITY) |
104 set_city(value); | 104 set_city(value); |
105 else if (subgroup == AutoFillType::ADDRESS_STATE) | 105 else if (subgroup == AutoFillType::ADDRESS_STATE) |
106 set_state(value); | 106 set_state(value); |
107 else if (subgroup == AutoFillType::ADDRESS_COUNTRY) | 107 else if (subgroup == AutoFillType::ADDRESS_COUNTRY) |
108 set_country(value); | 108 set_country(value); |
109 else if (subgroup == AutoFillType::ADDRESS_ZIP) | 109 else if (subgroup == AutoFillType::ADDRESS_ZIP) |
110 set_zip_code(value); | 110 set_zip_code(value); |
111 else | 111 else |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return false; | 200 return false; |
201 } | 201 } |
202 | 202 |
203 match->clear(); | 203 match->clear(); |
204 if (subgroup == AutoFillType::ADDRESS_LINE1 && | 204 if (subgroup == AutoFillType::ADDRESS_LINE1 && |
205 StartsWith(line1(), info, false)) { | 205 StartsWith(line1(), info, false)) { |
206 *match = line1(); | 206 *match = line1(); |
207 } else if (subgroup == AutoFillType::ADDRESS_LINE2 && | 207 } else if (subgroup == AutoFillType::ADDRESS_LINE2 && |
208 StartsWith(line2(), info, false)) { | 208 StartsWith(line2(), info, false)) { |
209 *match = line2(); | 209 *match = line2(); |
210 } else if (subgroup == AutoFillType::ADDRESS_APPT_NUM && | 210 } else if (subgroup == AutoFillType::ADDRESS_APT_NUM && |
211 StartsWith(apt_num(), info, true)) { | 211 StartsWith(apt_num(), info, true)) { |
212 *match = apt_num(); | 212 *match = apt_num(); |
213 } else if (subgroup == AutoFillType::ADDRESS_CITY && | 213 } else if (subgroup == AutoFillType::ADDRESS_CITY && |
214 StartsWith(city(), info, false)) { | 214 StartsWith(city(), info, false)) { |
215 *match = city(); | 215 *match = city(); |
216 } else if (subgroup == AutoFillType::ADDRESS_STATE && | 216 } else if (subgroup == AutoFillType::ADDRESS_STATE && |
217 StartsWith(state(), info, false)) { | 217 StartsWith(state(), info, false)) { |
218 *match = state(); | 218 *match = state(); |
219 } else if (subgroup == AutoFillType::ADDRESS_COUNTRY && | 219 } else if (subgroup == AutoFillType::ADDRESS_COUNTRY && |
220 StartsWith(country(), info, false)) { | 220 StartsWith(country(), info, false)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 bool Address::IsWordInLine(const string16& word, | 256 bool Address::IsWordInLine(const string16& word, |
257 const LineTokens& line_tokens) const { | 257 const LineTokens& line_tokens) const { |
258 LineTokens::const_iterator iter; | 258 LineTokens::const_iterator iter; |
259 for (iter = line_tokens.begin(); iter != line_tokens.end(); ++iter) { | 259 for (iter = line_tokens.begin(); iter != line_tokens.end(); ++iter) { |
260 if (word == *iter) | 260 if (word == *iter) |
261 return true; | 261 return true; |
262 } | 262 } |
263 | 263 |
264 return false; | 264 return false; |
265 } | 265 } |
OLD | NEW |