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 // This file contains the Search autocomplete provider. This provider is | 5 // This file contains the Search autocomplete provider. This provider is |
6 // responsible for all autocomplete entries that start with "Search <engine> | 6 // responsible for all autocomplete entries that start with "Search <engine> |
7 // for ...", including searching for the current input string, search | 7 // for ...", including searching for the current input string, search |
8 // history, and search suggestions. An instance of it gets created and | 8 // history, and search suggestions. An instance of it gets created and |
9 // managed by the autocomplete controller. | 9 // managed by the autocomplete controller. |
10 | 10 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 // Gets the relevance score for the keyword verbatim result. | 429 // Gets the relevance score for the keyword verbatim result. |
430 // |relevance_from_server| is handled as in GetVerbatimRelevance(). | 430 // |relevance_from_server| is handled as in GetVerbatimRelevance(). |
431 // TODO(mpearson): Refactor so this duplication isn't necesary or | 431 // TODO(mpearson): Refactor so this duplication isn't necesary or |
432 // restructure so one static function takes all the parameters it needs | 432 // restructure so one static function takes all the parameters it needs |
433 // (rather than looking at internal state). | 433 // (rather than looking at internal state). |
434 int GetKeywordVerbatimRelevance(bool* relevance_from_server) const; | 434 int GetKeywordVerbatimRelevance(bool* relevance_from_server) const; |
435 | 435 |
436 // |time| is the time at which this query was last seen. |is_keyword| | 436 // |time| is the time at which this query was last seen. |is_keyword| |
437 // indicates whether the results correspond to the keyword provider or default | 437 // indicates whether the results correspond to the keyword provider or default |
438 // provider. |prevent_inline_autocomplete| is true if we should not inline | 438 // provider. |prevent_inline_autocomplete| is true if we should not inline |
439 // autocomplete this query. | 439 // autocomplete this query. |prevent_search_history_inlining| is true |
440 // if we would normally inline autocomplete this query but want to shift | |
441 // the relevance curve slightly downward. | |
Peter Kasting
2013/08/01 22:44:48
Nit: You might want a clearer explanation of these
Mark P
2013/08/02 00:44:36
With judicious renaming, I think I managed to rewr
| |
440 int CalculateRelevanceForHistory(const base::Time& time, | 442 int CalculateRelevanceForHistory(const base::Time& time, |
441 bool is_keyword, | 443 bool is_keyword, |
442 bool prevent_inline_autocomplete) const; | 444 bool prevent_inline_autocomplete, |
445 bool prevent_search_history_inlining) const; | |
443 | 446 |
444 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with | 447 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with |
445 // the supplied relevance. Adds this match to |map|; if such a match already | 448 // the supplied relevance. Adds this match to |map|; if such a match already |
446 // exists, whichever one has lower relevance is eliminated. | 449 // exists, whichever one has lower relevance is eliminated. |
447 void AddMatchToMap(const string16& query_string, | 450 void AddMatchToMap(const string16& query_string, |
448 const string16& input_text, | 451 const string16& input_text, |
449 int relevance, | 452 int relevance, |
450 bool relevance_from_server, | 453 bool relevance_from_server, |
451 AutocompleteMatch::Type type, | 454 AutocompleteMatch::Type type, |
452 int accepted_suggestion, | 455 int accepted_suggestion, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 // session. | 527 // session. |
525 bool field_trial_triggered_in_session_; | 528 bool field_trial_triggered_in_session_; |
526 | 529 |
527 // Start margin of the omnibox. Used to construct search URLs. | 530 // Start margin of the omnibox. Used to construct search URLs. |
528 int omnibox_start_margin_; | 531 int omnibox_start_margin_; |
529 | 532 |
530 // If true, search history query suggestions will score low enough that | 533 // If true, search history query suggestions will score low enough that |
531 // they will not be inlined. | 534 // they will not be inlined. |
532 bool prevent_search_history_inlining_; | 535 bool prevent_search_history_inlining_; |
533 | 536 |
534 // If true, no search history query suggestions will be offered. | |
535 bool disable_search_history_; | |
536 | |
537 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 537 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
538 }; | 538 }; |
539 | 539 |
540 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 540 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |