Chromium Code Reviews| 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 "chrome/browser/autocomplete/bookmark_provider.h" | 5 #include "chrome/browser/autocomplete/bookmark_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 match.fill_into_edit.substr(inline_autocomplete_offset); | 217 match.fill_into_edit.substr(inline_autocomplete_offset); |
| 218 } | 218 } |
| 219 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || | 219 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || |
| 220 !HistoryProvider::PreventInlineAutocomplete(input); | 220 !HistoryProvider::PreventInlineAutocomplete(input); |
| 221 } | 221 } |
| 222 match.description = title; | 222 match.description = title; |
| 223 match.description_class = | 223 match.description_class = |
| 224 ClassificationsFromMatch(bookmark_match.title_match_positions, | 224 ClassificationsFromMatch(bookmark_match.title_match_positions, |
| 225 match.description.size(), | 225 match.description.size(), |
| 226 false); | 226 false); |
| 227 match.PossiblySwapContentsAndDescriptionForURLSuggestion(input); | |
|
Peter Kasting
2015/05/21 21:55:33
Rather than adding these calls to each provider, c
Mark P
2015/05/21 23:47:36
I thought about it quite a bit. If we wanted to s
Peter Kasting
2015/05/22 00:52:42
Huh. Seems a lot simpler and clearer to me the ot
Mark P
2015/05/22 22:51:29
I tried the other way. It looks less messy than I
| |
| 227 | 228 |
| 228 // Summary on how a relevance score is determined for the match: | 229 // Summary on how a relevance score is determined for the match: |
| 229 // | 230 // |
| 230 // For each match within the bookmark's title or URL (or both), calculate a | 231 // For each match within the bookmark's title or URL (or both), calculate a |
| 231 // 'factor', sum up those factors, then use the sum to figure out a value | 232 // 'factor', sum up those factors, then use the sum to figure out a value |
| 232 // between the base score and the maximum score. | 233 // between the base score and the maximum score. |
| 233 // | 234 // |
| 234 // The factor for each match is the product of: | 235 // The factor for each match is the product of: |
| 235 // | 236 // |
| 236 // 1) how many characters in the bookmark's title/URL are part of this match. | 237 // 1) how many characters in the bookmark's title/URL are part of this match. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 i != positions.end(); | 340 i != positions.end(); |
| 340 ++i) { | 341 ++i) { |
| 341 AutocompleteMatch::ACMatchClassifications new_class; | 342 AutocompleteMatch::ACMatchClassifications new_class; |
| 342 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 343 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
| 343 text_length, url_style, &new_class); | 344 text_length, url_style, &new_class); |
| 344 classifications = AutocompleteMatch::MergeClassifications( | 345 classifications = AutocompleteMatch::MergeClassifications( |
| 345 classifications, new_class); | 346 classifications, new_class); |
| 346 } | 347 } |
| 347 return classifications; | 348 return classifications; |
| 348 } | 349 } |
| OLD | NEW |