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 #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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // Various values used in scoring, made public so other providers | 186 // Various values used in scoring, made public so other providers |
187 // can insert results in appropriate ranges relative to these. | 187 // can insert results in appropriate ranges relative to these. |
188 static const int kScoreForBestInlineableResult; | 188 static const int kScoreForBestInlineableResult; |
189 static const int kScoreForUnvisitedIntranetResult; | 189 static const int kScoreForUnvisitedIntranetResult; |
190 static const int kScoreForWhatYouTypedResult; | 190 static const int kScoreForWhatYouTypedResult; |
191 static const int kBaseScoreForNonInlineableResult; | 191 static const int kBaseScoreForNonInlineableResult; |
192 | 192 |
193 HistoryURLProvider(AutocompleteProviderListener* listener, Profile* profile); | 193 HistoryURLProvider(AutocompleteProviderListener* listener, Profile* profile); |
194 | 194 |
195 // HistoryProvider: | 195 // HistoryProvider: |
196 virtual void Start(const AutocompleteInput& input, | 196 void Start(const AutocompleteInput& input, |
197 bool minimal_changes, | 197 bool minimal_changes, |
198 bool called_due_to_focus) override; | 198 bool called_due_to_focus) override; |
199 virtual void Stop(bool clear_cached_results, | 199 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; |
200 bool due_to_user_inactivity) override; | |
201 | 200 |
202 // Returns a match representing a navigation to |destination_url| given user | 201 // Returns a match representing a navigation to |destination_url| given user |
203 // input of |text|. |trim_http| controls whether the match's |fill_into_edit| | 202 // input of |text|. |trim_http| controls whether the match's |fill_into_edit| |
204 // and |contents| should have any HTTP scheme stripped off, and should not be | 203 // and |contents| should have any HTTP scheme stripped off, and should not be |
205 // set to true if |text| contains an http prefix. | 204 // set to true if |text| contains an http prefix. |
206 // NOTES: This does not set the relevance of the returned match, as different | 205 // NOTES: This does not set the relevance of the returned match, as different |
207 // callers want different behavior. Callers must set this manually. | 206 // callers want different behavior. Callers must set this manually. |
208 // This function should only be called on the UI thread. | 207 // This function should only be called on the UI thread. |
209 AutocompleteMatch SuggestExactInput(const base::string16& text, | 208 AutocompleteMatch SuggestExactInput(const base::string16& text, |
210 const GURL& destination_url, | 209 const GURL& destination_url, |
(...skipping 11 matching lines...) Expand all Loading... |
222 FRIEND_TEST_ALL_PREFIXES(HistoryURLProviderTest, HUPScoringExperiment); | 221 FRIEND_TEST_ALL_PREFIXES(HistoryURLProviderTest, HUPScoringExperiment); |
223 | 222 |
224 enum MatchType { | 223 enum MatchType { |
225 NORMAL, | 224 NORMAL, |
226 WHAT_YOU_TYPED, | 225 WHAT_YOU_TYPED, |
227 INLINE_AUTOCOMPLETE, | 226 INLINE_AUTOCOMPLETE, |
228 UNVISITED_INTRANET, // An intranet site that has never been visited. | 227 UNVISITED_INTRANET, // An intranet site that has never been visited. |
229 }; | 228 }; |
230 class VisitClassifier; | 229 class VisitClassifier; |
231 | 230 |
232 ~HistoryURLProvider(); | 231 ~HistoryURLProvider() override; |
233 | 232 |
234 // Determines the relevance for a match, given its type. If |match_type| is | 233 // Determines the relevance for a match, given its type. If |match_type| is |
235 // NORMAL, |match_number| is a number indicating the relevance of the match | 234 // NORMAL, |match_number| is a number indicating the relevance of the match |
236 // (higher == more relevant). For other values of |match_type|, | 235 // (higher == more relevant). For other values of |match_type|, |
237 // |match_number| is ignored. Only called some of the time; for some matches, | 236 // |match_number| is ignored. Only called some of the time; for some matches, |
238 // relevancy scores are assigned consecutively decreasing (1416, 1415, ...). | 237 // relevancy scores are assigned consecutively decreasing (1416, 1415, ...). |
239 static int CalculateRelevance(MatchType match_type, int match_number); | 238 static int CalculateRelevance(MatchType match_type, int match_number); |
240 | 239 |
241 // Returns a set of classifications that highlight all the occurrences of | 240 // Returns a set of classifications that highlight all the occurrences of |
242 // |input_text| at word breaks in |description|. | 241 // |input_text| at word breaks in |description|. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // keep this member is so we can set the cancel bit on it. | 332 // keep this member is so we can set the cancel bit on it. |
334 HistoryURLProviderParams* params_; | 333 HistoryURLProviderParams* params_; |
335 | 334 |
336 // Params controlling experimental behavior of this provider. | 335 // Params controlling experimental behavior of this provider. |
337 HUPScoringParams scoring_params_; | 336 HUPScoringParams scoring_params_; |
338 | 337 |
339 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); | 338 DISALLOW_COPY_AND_ASSIGN(HistoryURLProvider); |
340 }; | 339 }; |
341 | 340 |
342 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ | 341 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |
OLD | NEW |