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

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

Issue 10260020: Make Omnibox HistoryURL Provider always aggressive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reordered EXPECT_GT to EXPECT_LT. Created 8 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 public: 139 public:
140 HistoryURLProvider(ACProviderListener* listener, Profile* profile); 140 HistoryURLProvider(ACProviderListener* listener, Profile* profile);
141 141
142 #ifdef UNIT_TEST 142 #ifdef UNIT_TEST
143 HistoryURLProvider(ACProviderListener* listener, 143 HistoryURLProvider(ACProviderListener* listener,
144 Profile* profile, 144 Profile* profile,
145 const std::string& languages) 145 const std::string& languages)
146 : HistoryProvider(listener, profile, "History"), 146 : HistoryProvider(listener, profile, "History"),
147 prefixes_(GetPrefixes()), 147 prefixes_(GetPrefixes()),
148 params_(NULL), 148 params_(NULL),
149 enable_aggressive_scoring_(false),
150 languages_(languages) {} 149 languages_(languages) {}
151 #endif 150 #endif
152 151
153 // AutocompleteProvider 152 // AutocompleteProvider
154 virtual void Start(const AutocompleteInput& input, 153 virtual void Start(const AutocompleteInput& input,
155 bool minimal_changes) OVERRIDE; 154 bool minimal_changes) OVERRIDE;
156 virtual void Stop() OVERRIDE; 155 virtual void Stop() OVERRIDE;
157 156
158 // Runs the history query on the history thread, called by the history 157 // Runs the history query on the history thread, called by the history
159 // system. The history database MAY BE NULL in which case it is not 158 // system. The history database MAY BE NULL in which case it is not
(...skipping 21 matching lines...) Expand all
181 INLINE_AUTOCOMPLETE, 180 INLINE_AUTOCOMPLETE,
182 UNVISITED_INTRANET, // An intranet site that has never been visited. 181 UNVISITED_INTRANET, // An intranet site that has never been visited.
183 }; 182 };
184 class VisitClassifier; 183 class VisitClassifier;
185 184
186 ~HistoryURLProvider(); 185 ~HistoryURLProvider();
187 186
188 // Returns the set of prefixes to use for prefixes_. 187 // Returns the set of prefixes to use for prefixes_.
189 static history::Prefixes GetPrefixes(); 188 static history::Prefixes GetPrefixes();
190 189
191 // Determines the relevance for a match, given its type. Behavior 190 // Determines the relevance for a match, given its type. If
192 // depends on enable_aggressive_scoring_. If |match_type| is 191 // |match_type| is NORMAL, |match_number| is a number [0,
193 // NORMAL, |match_number| is a number [0, kMaxSuggestions) 192 // kMaxSuggestions) indicating the relevance of the match (higher ==
194 // indicating the relevance of the match (higher == more relevant). 193 // more relevant). For other values of |match_type|, |match_number|
195 // For other values of |match_type|, |match_number| is ignored. 194 // is ignored. Only called some of the time; for some matches,
196 // Only called some of the time; for some matches, relevancy scores 195 // relevancy scores are assigned consecutively decreasing (1416,
197 // are assigned consecutively decreasing (1416, 1415, 1414, ...). 196 // 1415, 1414, ...).
198 int CalculateRelevance(MatchType match_type, 197 int CalculateRelevance(MatchType match_type,
199 size_t match_number) const; 198 size_t match_number) const;
200 199
201 // Helper function that actually launches the two autocomplete passes. 200 // Helper function that actually launches the two autocomplete passes.
202 void RunAutocompletePasses(const AutocompleteInput& input, 201 void RunAutocompletePasses(const AutocompleteInput& input,
203 bool fixup_input_and_run_pass_1); 202 bool fixup_input_and_run_pass_1);
204 203
205 // Returns the best prefix that begins |text|. "Best" means "greatest number 204 // Returns the best prefix that begins |text|. "Best" means "greatest number
206 // of components". This may return NULL if no prefix begins |text|. 205 // of components". This may return NULL if no prefix begins |text|.
207 // 206 //
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 274
276 // Prefixes to try appending to user input when looking for a match. 275 // Prefixes to try appending to user input when looking for a match.
277 const history::Prefixes prefixes_; 276 const history::Prefixes prefixes_;
278 277
279 // Params for the current query. The provider should not free this directly; 278 // Params for the current query. The provider should not free this directly;
280 // instead, it is passed as a parameter through the history backend, and the 279 // instead, it is passed as a parameter through the history backend, and the
281 // parameter itself is freed once it's no longer needed. The only reason we 280 // parameter itself is freed once it's no longer needed. The only reason we
282 // keep this member is so we can set the cancel bit on it. 281 // keep this member is so we can set the cancel bit on it.
283 HistoryURLProviderParams* params_; 282 HistoryURLProviderParams* params_;
284 283
285 // Command line flag omnibox-aggressive-with-history-urls.
286 // We examine and cache the value in the constructor.
287 bool enable_aggressive_scoring_;
288
289 // Only used by unittests; if non-empty, overrides accept-languages in the 284 // Only used by unittests; if non-empty, overrides accept-languages in the
290 // profile's pref system. 285 // profile's pref system.
291 std::string languages_; 286 std::string languages_;
292 }; 287 };
293 288
294 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ 289 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_field_trial.cc ('k') | chrome/browser/autocomplete/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698