| 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/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 <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "base/i18n/word_iterator.h" | 11 #include "base/i18n/break_iterator.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/autocomplete/history_provider_util.h" | 15 #include "chrome/browser/autocomplete/history_provider_util.h" |
| 16 #include "chrome/browser/history/url_database.h" | 16 #include "chrome/browser/history/url_database.h" |
| 17 #include "net/base/escape.h" | 17 #include "net/base/escape.h" |
| 18 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
| 19 #include "unicode/utypes.h" // for int32_t | 19 #include "unicode/utypes.h" // for int32_t |
| 20 | 20 |
| 21 using base::Time; | 21 using base::Time; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 return history_id_set; | 228 return history_id_set; |
| 229 } | 229 } |
| 230 | 230 |
| 231 // Utility Functions | 231 // Utility Functions |
| 232 | 232 |
| 233 // static | 233 // static |
| 234 InMemoryURLIndex::String16Set InMemoryURLIndex::WordSetFromString16( | 234 InMemoryURLIndex::String16Set InMemoryURLIndex::WordSetFromString16( |
| 235 const string16& uni_string) { | 235 const string16& uni_string) { |
| 236 String16Set words; | 236 String16Set words; |
| 237 WordIterator iter(&uni_string, WordIterator::BREAK_WORD); | 237 base::BreakIterator iter(&uni_string, base::BreakIterator::BREAK_WORD); |
| 238 if (iter.Init()) { | 238 if (iter.Init()) { |
| 239 while (iter.Advance()) { | 239 while (iter.Advance()) { |
| 240 if (iter.IsWord()) | 240 if (iter.IsWord()) |
| 241 words.insert(iter.GetWord()); | 241 words.insert(iter.GetString()); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 return words; | 244 return words; |
| 245 } | 245 } |
| 246 | 246 |
| 247 // static | 247 // static |
| 248 InMemoryURLIndex::Char16Set InMemoryURLIndex::CharactersFromString16( | 248 InMemoryURLIndex::Char16Set InMemoryURLIndex::CharactersFromString16( |
| 249 const string16& uni_word) { | 249 const string16& uni_word) { |
| 250 Char16Set characters; | 250 Char16Set characters; |
| 251 for (string16::const_iterator iter = uni_word.begin(); | 251 for (string16::const_iterator iter = uni_word.begin(); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 if (scored_matches_.size() > 10) { | 523 if (scored_matches_.size() > 10) { |
| 524 scored_matches_.erase(scored_matches_.begin() + 10, | 524 scored_matches_.erase(scored_matches_.begin() + 10, |
| 525 scored_matches_.end()); | 525 scored_matches_.end()); |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 } | 528 } |
| 529 } | 529 } |
| 530 } | 530 } |
| 531 | 531 |
| 532 } // namespace history | 532 } // namespace history |
| OLD | NEW |