Chromium Code Reviews| Index: chrome/browser/autocomplete/base_search_provider.h |
| diff --git a/chrome/browser/autocomplete/base_search_provider.h b/chrome/browser/autocomplete/base_search_provider.h |
| index 41547b28032f390250128617291665db755dfeb3..07d44e7b960bace6b8ee0eaefa94a5336062a623 100644 |
| --- a/chrome/browser/autocomplete/base_search_provider.h |
| +++ b/chrome/browser/autocomplete/base_search_provider.h |
| @@ -39,6 +39,9 @@ class BaseSearchProvider : public AutocompleteProvider, |
| Profile* profile, |
| AutocompleteProvider::Type type); |
| + // Returns whether |match| is flagged as a query that should be prefetched. |
|
Mark P
2014/02/12 23:35:49
Are only queries allowed to be prefetched, or do p
Maria
2014/02/13 21:07:36
This is only used to prefetch Google search page r
|
| + static bool ShouldPrefetch(const AutocompleteMatch& match); |
| + |
| // AutocompleteProvider: |
| virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; |
| @@ -47,6 +50,26 @@ class BaseSearchProvider : public AutocompleteProvider, |
| } |
| protected: |
| + // The following keys are used to record additional information on matches. |
| + |
| + // We annotate our AutocompleteMatches with whether their relevance scores |
| + // were server-provided using this key in the |additional_info| field. |
| + static const char kRelevanceFromServerKey[]; |
| + |
| + // Indicates whether the server said a match should be prefetched. |
| + static const char kShouldPrefetchKey[]; |
| + |
| + // Used to store metadata from the server response, which is needed for |
| + // prefetching. |
| + static const char kSuggestMetadataKey[]; |
| + |
| + // Used to store a deletion request url for server-provided suggestions. |
| + static const char kDeletionUrlKey[]; |
| + |
| + // These are the values for the above keys. |
| + static const char kTrue[]; |
| + static const char kFalse[]; |
| + |
| virtual ~BaseSearchProvider(); |
| // The Result classes are intermediate representations of AutocompleteMatches, |
| @@ -258,21 +281,20 @@ class BaseSearchProvider : public AutocompleteProvider, |
| // for the search |suggestion|, which represents a search via |template_url|. |
| // If |template_url| is NULL, returns a match with an invalid destination URL. |
| // |
| - // |input_text| is the original user input. This is used to highlight |
| + // |input| is the original user input. Text in the input is used to highlight |
| // portions of the match contents to distinguish locally-typed text from |
| // suggested text. |
| // |
| - // |input| is necessary for various other details, like whether we should |
| + // |input| is also necessary for various other details, like whether we should |
| // allow inline autocompletion and what the transition type should be. |
| - // |accepted_suggestion| and |omnibox_start_margin| are used along with |
| - // |input_text| to generate Assisted Query Stats. |
| + // |accepted_suggestion| and |omnibox_start_margin| are used to generate |
| + // Assisted Query Stats. |
| // |append_extra_query_params| should be set if |template_url| is the default |
| // search engine, so the destination URL will contain any |
| // command-line-specified query params. |
| static AutocompleteMatch CreateSearchSuggestion( |
| AutocompleteProvider* autocomplete_provider, |
| const AutocompleteInput& input, |
| - const base::string16& input_text, |
| const SuggestResult& suggestion, |
| const TemplateURL* template_url, |
| int accepted_suggestion, |
| @@ -313,6 +335,22 @@ class BaseSearchProvider : public AutocompleteProvider, |
| AutocompleteInput::PageClassification page_classification, |
| Profile* profile); |
| + // Creates an AutocompleteMatch from |result| to search |template_url| for |
| + // |input| text. Adds the created match to |map|; if such a match already |
|
Mark P
2014/02/12 23:35:49
This doesn't sound right. Shouldn't it create a m
Maria
2014/02/13 21:07:36
Done.
|
| + // exists, whichever one has lower relevance is eliminated. |
| + // |metadata| and |accepted_suggestion| are used for generating an |
| + // AutocompleteMatch. |
| + void AddMatchToMap(const SuggestResult& result, |
| + const AutocompleteInput& input, |
| + const TemplateURL* template_url, |
| + const std::string& metadata, |
| + int accepted_suggestion, |
| + MatchMap* map); |
| + |
| + // Returns whether the destination URL for an AutocompleteMatch corresponding |
|
Mark P
2014/02/12 23:35:49
I find the phrase "for an AutocompleteMatch" here
Maria
2014/02/13 21:07:36
Done.
|
| + // to the given |result| should contain command-line-specified query params. |
| + virtual bool ShouldAppendExtraParams(const SuggestResult& result) const = 0; |
| + |
| // Whether a field trial, if any, has triggered in the most recent |
| // autocomplete query. This field is set to true only if the suggestion |
| // provider has completed and the response contained |