Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/autocomplete/autocomplete_match.h" 18 #include "chrome/browser/autocomplete/autocomplete_match.h"
19 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" 19 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h"
20 #include "chrome/browser/autocomplete/autocomplete_result.h" 20 #include "chrome/browser/autocomplete/autocomplete_result.h"
21 #include "chrome/browser/bookmarks/bookmark_utils.h"
21 #include "chrome/browser/history/history_backend.h" 22 #include "chrome/browser/history/history_backend.h"
22 #include "chrome/browser/history/history_database.h" 23 #include "chrome/browser/history/history_database.h"
23 #include "chrome/browser/history/history_service.h" 24 #include "chrome/browser/history/history_service.h"
24 #include "chrome/browser/history/history_service_factory.h" 25 #include "chrome/browser/history/history_service_factory.h"
25 #include "chrome/browser/history/history_types.h" 26 #include "chrome/browser/history/history_types.h"
26 #include "chrome/browser/history/in_memory_url_index_types.h" 27 #include "chrome/browser/history/in_memory_url_index_types.h"
27 #include "chrome/browser/history/scored_history_match.h" 28 #include "chrome/browser/history/scored_history_match.h"
28 #include "chrome/browser/omnibox/omnibox_field_trial.h" 29 #include "chrome/browser/omnibox/omnibox_field_trial.h"
29 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
30 #include "chrome/browser/search_engines/template_url_service.h" 31 #include "chrome/browser/search_engines/template_url_service.h"
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 } 1142 }
1142 1143
1143 DCHECK_LE(relevance, old_relevance); 1144 DCHECK_LE(relevance, old_relevance);
1144 return relevance; 1145 return relevance;
1145 } 1146 }
1146 1147
1147 // static 1148 // static
1148 ACMatchClassifications HistoryURLProvider::ClassifyDescription( 1149 ACMatchClassifications HistoryURLProvider::ClassifyDescription(
1149 const base::string16& input_text, 1150 const base::string16& input_text,
1150 const base::string16& description) { 1151 const base::string16& description) {
1151 base::string16 clean_description = history::CleanUpTitleForMatching( 1152 base::string16 clean_description = bookmark_utils::CleanUpTitleForMatching(
1152 description); 1153 description);
1153 history::TermMatches description_matches(SortAndDeoverlapMatches( 1154 history::TermMatches description_matches(SortAndDeoverlapMatches(
1154 history::MatchTermInString(input_text, clean_description, 0))); 1155 history::MatchTermInString(input_text, clean_description, 0)));
1155 history::WordStarts description_word_starts; 1156 history::WordStarts description_word_starts;
1156 history::String16VectorFromString16( 1157 history::String16VectorFromString16(
1157 clean_description, false, &description_word_starts); 1158 clean_description, false, &description_word_starts);
1158 description_matches = 1159 description_matches =
1159 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( 1160 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts(
1160 description_matches, description_word_starts, 0, std::string::npos); 1161 description_matches, description_word_starts, 0, std::string::npos);
1161 return SpansFromTermMatch( 1162 return SpansFromTermMatch(
1162 description_matches, clean_description.length(), false); 1163 description_matches, clean_description.length(), false);
1163 } 1164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698