| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 706 |
| 707 default: // NORMAL | 707 default: // NORMAL |
| 708 return kBaseScoreForNonInlineableResult + match_number; | 708 return kBaseScoreForNonInlineableResult + match_number; |
| 709 } | 709 } |
| 710 } | 710 } |
| 711 | 711 |
| 712 // static | 712 // static |
| 713 ACMatchClassifications HistoryURLProvider::ClassifyDescription( | 713 ACMatchClassifications HistoryURLProvider::ClassifyDescription( |
| 714 const base::string16& input_text, | 714 const base::string16& input_text, |
| 715 const base::string16& description) { | 715 const base::string16& description) { |
| 716 base::string16 clean_description = bookmark_utils::CleanUpTitleForMatching( | 716 base::string16 clean_description = |
| 717 description); | 717 bookmarks::CleanUpTitleForMatching(description); |
| 718 history::TermMatches description_matches(SortAndDeoverlapMatches( | 718 history::TermMatches description_matches(SortAndDeoverlapMatches( |
| 719 history::MatchTermInString(input_text, clean_description, 0))); | 719 history::MatchTermInString(input_text, clean_description, 0))); |
| 720 history::WordStarts description_word_starts; | 720 history::WordStarts description_word_starts; |
| 721 history::String16VectorFromString16( | 721 history::String16VectorFromString16( |
| 722 clean_description, false, &description_word_starts); | 722 clean_description, false, &description_word_starts); |
| 723 // If HistoryURL retrieves any matches (and hence we reach this code), we | 723 // If HistoryURL retrieves any matches (and hence we reach this code), we |
| 724 // are guaranteed that the beginning of input_text must be a word break. | 724 // are guaranteed that the beginning of input_text must be a word break. |
| 725 history::WordStarts offsets(1, 0u); | 725 history::WordStarts offsets(1, 0u); |
| 726 description_matches = | 726 description_matches = |
| 727 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( | 727 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1196 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
| 1197 match.contents.length(), ACMatchClassification::URL, | 1197 match.contents.length(), ACMatchClassification::URL, |
| 1198 &match.contents_class); | 1198 &match.contents_class); |
| 1199 } | 1199 } |
| 1200 match.description = info.title(); | 1200 match.description = info.title(); |
| 1201 match.description_class = | 1201 match.description_class = |
| 1202 ClassifyDescription(params.input.text(), match.description); | 1202 ClassifyDescription(params.input.text(), match.description); |
| 1203 RecordAdditionalInfoFromUrlRow(info, &match); | 1203 RecordAdditionalInfoFromUrlRow(info, &match); |
| 1204 return match; | 1204 return match; |
| 1205 } | 1205 } |
| OLD | NEW |