diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 15:35:25 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 15:35:25 +0000 |
commit | e5366896e9ccb3dd17c590d115bd999e987a33af (patch) | |
tree | 52f4fc2f07b73aaca1199adb1384b123130c22ed /chrome/browser/bookmarks/bookmark_index.cc | |
parent | b133cc2db84fc83d5c4aa53020237788fa344c75 (diff) | |
download | chromium_src-e5366896e9ccb3dd17c590d115bd999e987a33af.zip chromium_src-e5366896e9ccb3dd17c590d115bd999e987a33af.tar.gz chromium_src-e5366896e9ccb3dd17c590d115bd999e987a33af.tar.bz2 |
Replace wstring with string16 in history. The only time wstring is used now in history is for bookmark-related stuff (the bookmarks system is still wstring-based).
The substantial change here is in RTL to make a string16 variant of the functions and in changing the WordIterator to use string16 (this cleaned up some weird utf-32 code).
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/2808017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_index.cc')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_index.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/chrome/browser/bookmarks/bookmark_index.cc b/chrome/browser/bookmarks/bookmark_index.cc index 18c3134..161058e 100644 --- a/chrome/browser/bookmarks/bookmark_index.cc +++ b/chrome/browser/bookmarks/bookmark_index.cc @@ -62,7 +62,7 @@ void BookmarkIndex::GetBookmarksWithTitlesMatching( // matches and so this shouldn't be performance critical. QueryParser parser; ScopedVector<QueryNode> query_nodes; - parser.ParseQuery(query, &query_nodes.get()); + parser.ParseQuery(WideToUTF16(query), &query_nodes.get()); // The highest typed counts should be at the beginning of the results vector // so that the best matches will always be included in the results. The loop @@ -115,7 +115,7 @@ void BookmarkIndex::AddMatchToResults( // of QueryParser may filter it out. For example, the query // ["thi"] will match the bookmark titled [Thinking], but since // ["thi"] is quoted we don't want to do a prefix match. - if (parser->DoesQueryMatch(node->GetTitle(), query_nodes, + if (parser->DoesQueryMatch(WideToUTF16(node->GetTitle()), query_nodes, &(title_match.match_positions))) { title_match.node = node; results->push_back(title_match); @@ -129,7 +129,7 @@ bool BookmarkIndex::GetBookmarksWithTitleMatchingTerm(const std::wstring& term, if (i == index_.end()) return false; - if (!QueryParser::IsWordLongEnoughForPrefixSearch(term)) { + if (!QueryParser::IsWordLongEnoughForPrefixSearch(WideToUTF16(term))) { // Term is too short for prefix match, compare using exact match. if (i->first != term) return false; // No bookmarks with this term. @@ -206,13 +206,23 @@ void BookmarkIndex::CombineMatches(const Index::const_iterator& index_i, std::vector<std::wstring> BookmarkIndex::ExtractQueryWords( const std::wstring& query) { - std::vector<std::wstring> terms; + std::vector<string16> terms; if (query.empty()) - return terms; + return std::vector<std::wstring>(); QueryParser parser; // TODO: use ICU normalization. - parser.ExtractQueryWords(l10n_util::ToLower(query), &terms); + parser.ExtractQueryWords(l10n_util::ToLower(WideToUTF16(query)), &terms); + + // TODO(brettw) just remove this and return |terms| when this is converted + // to string16. +#if defined(WCHAR_T_IS_UTF32) + std::vector<std::wstring> wterms; + for (size_t i = 0; i < terms.size(); i++) + wterms.push_back(UTF16ToWide(terms[i])); + return wterms; +#else return terms; +#endif } void BookmarkIndex::RegisterNode(const std::wstring& term, |