| 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/history/in_memory_url_index.h" | 5 #include "chrome/browser/history/in_memory_url_index.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 ++iter) | 480 ++iter) |
| 481 word_set.insert(base::i18n::ToLower(*iter)); | 481 word_set.insert(base::i18n::ToLower(*iter)); |
| 482 return word_set; | 482 return word_set; |
| 483 } | 483 } |
| 484 | 484 |
| 485 // static | 485 // static |
| 486 InMemoryURLIndex::String16Vector InMemoryURLIndex::WordVectorFromString16( | 486 InMemoryURLIndex::String16Vector InMemoryURLIndex::WordVectorFromString16( |
| 487 const string16& uni_string, | 487 const string16& uni_string, |
| 488 bool break_on_space) { | 488 bool break_on_space) { |
| 489 base::i18n::BreakIterator iter( | 489 base::i18n::BreakIterator iter( |
| 490 &uni_string, | 490 uni_string, |
| 491 break_on_space ? base::i18n::BreakIterator::BREAK_SPACE | 491 break_on_space ? base::i18n::BreakIterator::BREAK_SPACE |
| 492 : base::i18n::BreakIterator::BREAK_WORD); | 492 : base::i18n::BreakIterator::BREAK_WORD); |
| 493 String16Vector words; | 493 String16Vector words; |
| 494 if (!iter.Init()) | 494 if (!iter.Init()) |
| 495 return words; | 495 return words; |
| 496 while (iter.Advance()) { | 496 while (iter.Advance()) { |
| 497 if (break_on_space || iter.IsWord()) { | 497 if (break_on_space || iter.IsWord()) { |
| 498 string16 word = iter.GetString(); | 498 string16 word = iter.GetString(); |
| 499 if (break_on_space) | 499 if (break_on_space) |
| 500 TrimWhitespace(word, TRIM_ALL, &word); | 500 TrimWhitespace(word, TRIM_ALL, &word); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 if (iter->has_title()) { | 1083 if (iter->has_title()) { |
| 1084 string16 title(UTF8ToUTF16(iter->title())); | 1084 string16 title(UTF8ToUTF16(iter->title())); |
| 1085 url_row.set_title(title); | 1085 url_row.set_title(title); |
| 1086 } | 1086 } |
| 1087 history_info_map_[history_id] = url_row; | 1087 history_info_map_[history_id] = url_row; |
| 1088 } | 1088 } |
| 1089 return true; | 1089 return true; |
| 1090 } | 1090 } |
| 1091 | 1091 |
| 1092 } // namespace history | 1092 } // namespace history |
| OLD | NEW |