| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DCHECK_GT(std::distance(current_word.begin, current_word.end), 0); | 118 DCHECK_GT(std::distance(current_word.begin, current_word.end), 0); |
| 119 size_t current_word_length = std::distance( | 119 size_t current_word_length = std::distance( |
| 120 current_word.begin, current_word.end); | 120 current_word.begin, current_word.end); |
| 121 if (current_word_length > kMaxAddressNameWordLength) { | 121 if (current_word_length > kMaxAddressNameWordLength) { |
| 122 continue_on_house_number = false; | 122 continue_on_house_number = false; |
| 123 break; | 123 break; |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Check if the new word is a valid house number. | 126 // Check if the new word is a valid house number. |
| 127 if (house_number_parser.Parse(current_word.begin, current_word.end, | 127 if (house_number_parser.Parse(current_word.begin, current_word.end, |
| 128 NULL)) { | 128 nullptr)) { |
| 129 // Increase the number of consecutive house numbers since the beginning. | 129 // Increase the number of consecutive house numbers since the beginning. |
| 130 if (consecutive_house_numbers) { | 130 if (consecutive_house_numbers) { |
| 131 // Check if there is a new line between consecutive house numbers. | 131 // Check if there is a new line between consecutive house numbers. |
| 132 // This avoids false positives of the form "Cafe 21\n 750 Fifth Ave.." | 132 // This avoids false positives of the form "Cafe 21\n 750 Fifth Ave.." |
| 133 if (num_lines > 1) { | 133 if (num_lines > 1) { |
| 134 next_house_number_word = next_word; | 134 next_house_number_word = next_word; |
| 135 break; | 135 break; |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 it = words[next_word].end; | 211 it = words[next_word].end; |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace address_parser | 218 } // namespace address_parser |
| 219 | 219 |
| 220 } // namespace content | 220 } // namespace content |
| OLD | NEW |