| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 match.fill_into_edit.substr(inline_autocomplete_offset); | 188 match.fill_into_edit.substr(inline_autocomplete_offset); |
| 189 } | 189 } |
| 190 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || | 190 match.allowed_to_be_default_match = match.inline_autocompletion.empty() || |
| 191 !HistoryProvider::PreventInlineAutocomplete(input); | 191 !HistoryProvider::PreventInlineAutocomplete(input); |
| 192 } | 192 } |
| 193 match.description = title; | 193 match.description = title; |
| 194 match.description_class = | 194 match.description_class = |
| 195 ClassificationsFromMatch(bookmark_match.title_match_positions, | 195 ClassificationsFromMatch(bookmark_match.title_match_positions, |
| 196 match.description.size(), | 196 match.description.size(), |
| 197 false); | 197 false); |
| 198 match.starred = true; | |
| 199 | 198 |
| 200 // Summary on how a relevance score is determined for the match: | 199 // Summary on how a relevance score is determined for the match: |
| 201 // | 200 // |
| 202 // For each match within the bookmark's title or URL (or both), calculate a | 201 // For each match within the bookmark's title or URL (or both), calculate a |
| 203 // 'factor', sum up those factors, then use the sum to figure out a value | 202 // 'factor', sum up those factors, then use the sum to figure out a value |
| 204 // between the base score and the maximum score. | 203 // between the base score and the maximum score. |
| 205 // | 204 // |
| 206 // The factor for each match is the product of: | 205 // The factor for each match is the product of: |
| 207 // | 206 // |
| 208 // 1) how many characters in the bookmark's title/URL are part of this match. | 207 // 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... |
| 311 i != positions.end(); | 310 i != positions.end(); |
| 312 ++i) { | 311 ++i) { |
| 313 AutocompleteMatch::ACMatchClassifications new_class; | 312 AutocompleteMatch::ACMatchClassifications new_class; |
| 314 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, | 313 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, |
| 315 text_length, url_style, &new_class); | 314 text_length, url_style, &new_class); |
| 316 classifications = AutocompleteMatch::MergeClassifications( | 315 classifications = AutocompleteMatch::MergeClassifications( |
| 317 classifications, new_class); | 316 classifications, new_class); |
| 318 } | 317 } |
| 319 return classifications; | 318 return classifications; |
| 320 } | 319 } |
| OLD | NEW |