| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/search/tokenized_string_match.h" | 5 #include "ui/app_list/search/tokenized_string_match.h" |
| 6 | 6 |
| 7 #include "base/i18n/string_search.h" | 7 #include "base/i18n/string_search.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/ui/app_list/search/tokenized_string_char_iterator.h" | 9 #include "ui/app_list/search/tokenized_string_char_iterator.h" |
| 10 | 10 |
| 11 namespace app_list { | 11 namespace app_list { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // The factors below are applied when the current char of query matches | 15 // The factors below are applied when the current char of query matches |
| 16 // the current char of the text to be matched. Different factors are chosen | 16 // the current char of the text to be matched. Different factors are chosen |
| 17 // based on where the match happens. kIsPrefixMultiplier is used when the | 17 // based on where the match happens. kIsPrefixMultiplier is used when the |
| 18 // matched portion is a prefix of both the query and the text, which implies | 18 // matched portion is a prefix of both the query and the text, which implies |
| 19 // that the matched chars are at the same position in query and text. This is | 19 // that the matched chars are at the same position in query and text. This is |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool TokenizedStringMatch::Calculate(const base::string16& query, | 229 bool TokenizedStringMatch::Calculate(const base::string16& query, |
| 230 const base::string16& text) { | 230 const base::string16& text) { |
| 231 const TokenizedString tokenized_query(query); | 231 const TokenizedString tokenized_query(query); |
| 232 const TokenizedString tokenized_text(text); | 232 const TokenizedString tokenized_text(text); |
| 233 return Calculate(tokenized_query, tokenized_text); | 233 return Calculate(tokenized_query, tokenized_text); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace app_list | 236 } // namespace app_list |
| OLD | NEW |