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/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
698 return kBaseScoreForNonInlineableResult + match_number; | 698 return kBaseScoreForNonInlineableResult + match_number; |
699 } | 699 } |
700 } | 700 } |
701 | 701 |
702 // static | 702 // static |
703 ACMatchClassifications HistoryURLProvider::ClassifyDescription( | 703 ACMatchClassifications HistoryURLProvider::ClassifyDescription( |
704 const base::string16& input_text, | 704 const base::string16& input_text, |
705 const base::string16& description) { | 705 const base::string16& description) { |
706 base::string16 clean_description = | 706 base::string16 clean_description = |
707 bookmarks::CleanUpTitleForMatching(description); | 707 bookmarks::CleanUpTitleForMatching(description); |
708 history::TermMatches description_matches(SortAndDeoverlapMatches( | 708 TermMatches description_matches(SortAndDeoverlapMatches( |
709 history::MatchTermInString(input_text, clean_description, 0))); | 709 MatchTermInString(input_text, clean_description, 0))); |
710 history::WordStarts description_word_starts; | 710 WordStarts description_word_starts; |
711 history::String16VectorFromString16( | 711 String16VectorFromString16(clean_description, false, |
712 clean_description, false, &description_word_starts); | 712 &description_word_starts); |
Mark P
2015/02/27 20:57:56
nit: I think this fits in one line.
sdefresne
2015/03/02 08:54:14
almost, it is 81 characters :-)
| |
713 // If HistoryURL retrieves any matches (and hence we reach this code), we | 713 // If HistoryURL retrieves any matches (and hence we reach this code), we |
714 // are guaranteed that the beginning of input_text must be a word break. | 714 // are guaranteed that the beginning of input_text must be a word break. |
715 history::WordStarts offsets(1, 0u); | 715 WordStarts offsets(1, 0u); |
716 description_matches = | 716 description_matches = |
717 ScoredHistoryMatchBuilderImpl::FilterTermMatchesByWordStarts( | 717 ScoredHistoryMatchBuilderImpl::FilterTermMatchesByWordStarts( |
718 description_matches, offsets, description_word_starts, 0, | 718 description_matches, offsets, description_word_starts, 0, |
719 std::string::npos); | 719 std::string::npos); |
720 return SpansFromTermMatch( | 720 return SpansFromTermMatch( |
721 description_matches, clean_description.length(), false); | 721 description_matches, clean_description.length(), false); |
722 } | 722 } |
723 | 723 |
724 void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend, | 724 void HistoryURLProvider::DoAutocomplete(history::HistoryBackend* backend, |
725 history::URLDatabase* db, | 725 history::URLDatabase* db, |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1152 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1152 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
1153 match.contents.length(), ACMatchClassification::URL, | 1153 match.contents.length(), ACMatchClassification::URL, |
1154 &match.contents_class); | 1154 &match.contents_class); |
1155 } | 1155 } |
1156 match.description = info.title(); | 1156 match.description = info.title(); |
1157 match.description_class = | 1157 match.description_class = |
1158 ClassifyDescription(params.input.text(), match.description); | 1158 ClassifyDescription(params.input.text(), match.description); |
1159 RecordAdditionalInfoFromUrlRow(info, &match); | 1159 RecordAdditionalInfoFromUrlRow(info, &match); |
1160 return match; | 1160 return match; |
1161 } | 1161 } |
OLD | NEW |