OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/android/address_parser.h" | 5 #include "content/common/android/address_parser.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "content/common/android/address_parser_internal.h" | 9 #include "content/common/android/address_parser_internal.h" |
10 | 10 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 &tokenizer, &state_index)) { | 164 &tokenizer, &state_index)) { |
165 | 165 |
166 // A location name should have been found at this point. | 166 // A location name should have been found at this point. |
167 if (!found_location_name) | 167 if (!found_location_name) |
168 break; | 168 break; |
169 | 169 |
170 // Explicitly exclude "et al", as "al" is a valid state code. | 170 // Explicitly exclude "et al", as "al" is a valid state code. |
171 if (current_word_length == 2 && words.size() > 2) { | 171 if (current_word_length == 2 && words.size() > 2) { |
172 const Word& previous_word = words[state_first_word - 1]; | 172 const Word& previous_word = words[state_first_word - 1]; |
173 if (previous_word.end - previous_word.begin == 2 && | 173 if (previous_word.end - previous_word.begin == 2 && |
174 LowerCaseEqualsASCII(previous_word.begin, previous_word.end, | 174 base::LowerCaseEqualsASCII(previous_word.begin, |
175 "et") && | 175 previous_word.end, |
176 LowerCaseEqualsASCII(current_word.begin, current_word.end, | 176 "et") && |
177 "al")) | 177 base::LowerCaseEqualsASCII(current_word.begin, |
| 178 current_word.end, |
| 179 "al")) |
178 break; | 180 break; |
179 } | 181 } |
180 | 182 |
181 // Extract one more word from the tokenizer if not already available. | 183 // Extract one more word from the tokenizer if not already available. |
182 size_t zip_word = state_last_word + 1; | 184 size_t zip_word = state_last_word + 1; |
183 if (zip_word == words.size()) { | 185 if (zip_word == words.size()) { |
184 do { | 186 do { |
185 if (!tokenizer.GetNext()) | 187 if (!tokenizer.GetNext()) |
186 return false; | 188 return false; |
187 } while (tokenizer.token_is_delim()); | 189 } while (tokenizer.token_is_delim()); |
(...skipping 23 matching lines...) Expand all Loading... |
211 it = words[next_word].end; | 213 it = words[next_word].end; |
212 } | 214 } |
213 } | 215 } |
214 | 216 |
215 return false; | 217 return false; |
216 } | 218 } |
217 | 219 |
218 } // namespace address_parser | 220 } // namespace address_parser |
219 | 221 |
220 } // namespace content | 222 } // namespace content |
OLD | NEW |