Chromium Code Reviews| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 | 428 |
| 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. |use_aggressive_method| says whether this function can use a |
| 439 // autocomplete this query. | 439 // method that gives high scores (1200+) rather than one that gives lower |
| 440 // scores. When using the aggressive method, | |
| 441 // |prevent_search_history_inlining| indicates whether the scores are | |
| 442 // allowed to exceed 1300. | |
|
Peter Kasting
2013/08/02 19:57:41
Nit: This last sentence can be read to mean the op
Mark P
2013/08/02 20:01:48
Done.
| |
| 440 int CalculateRelevanceForHistory(const base::Time& time, | 443 int CalculateRelevanceForHistory(const base::Time& time, |
| 441 bool is_keyword, | 444 bool is_keyword, |
| 442 bool prevent_inline_autocomplete) const; | 445 bool use_aggressive_method, |
| 446 bool prevent_search_history_inlining) const; | |
| 443 | 447 |
| 444 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with | 448 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with |
| 445 // the supplied relevance. Adds this match to |map|; if such a match already | 449 // the supplied relevance. Adds this match to |map|; if such a match already |
| 446 // exists, whichever one has lower relevance is eliminated. | 450 // exists, whichever one has lower relevance is eliminated. |
| 447 void AddMatchToMap(const string16& query_string, | 451 void AddMatchToMap(const string16& query_string, |
| 448 const string16& input_text, | 452 const string16& input_text, |
| 449 int relevance, | 453 int relevance, |
| 450 bool relevance_from_server, | 454 bool relevance_from_server, |
| 451 AutocompleteMatch::Type type, | 455 AutocompleteMatch::Type type, |
| 452 int accepted_suggestion, | 456 int accepted_suggestion, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 // session. | 528 // session. |
| 525 bool field_trial_triggered_in_session_; | 529 bool field_trial_triggered_in_session_; |
| 526 | 530 |
| 527 // Start margin of the omnibox. Used to construct search URLs. | 531 // Start margin of the omnibox. Used to construct search URLs. |
| 528 int omnibox_start_margin_; | 532 int omnibox_start_margin_; |
| 529 | 533 |
| 530 // If true, search history query suggestions will score low enough that | 534 // If true, search history query suggestions will score low enough that |
| 531 // they will not be inlined. | 535 // they will not be inlined. |
| 532 bool prevent_search_history_inlining_; | 536 bool prevent_search_history_inlining_; |
| 533 | 537 |
| 534 // If true, no search history query suggestions will be offered. | |
| 535 bool disable_search_history_; | |
| 536 | |
| 537 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 538 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 538 }; | 539 }; |
| 539 | 540 |
| 540 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 541 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |