| 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 zero-suggest autocomplete provider. This experimental | 5 // This file contains the zero-suggest autocomplete provider. This experimental |
| 6 // provider is invoked when the user focuses in the omnibox prior to editing, | 6 // provider is invoked when the user focuses in the omnibox prior to editing, |
| 7 // and generates search query suggestions based on the current URL. To enable | 7 // and generates search query suggestions based on the current URL. To enable |
| 8 // this provider, point --experimental-zero-suggest-url-prefix at an | 8 // this provider, point --experimental-zero-suggest-url-prefix at an |
| 9 // appropriate suggestion service. | 9 // appropriate suggestion service. |
| 10 // | 10 // |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void AddSuggestResultsToMap(const SearchProvider::SuggestResults& results, | 113 void AddSuggestResultsToMap(const SearchProvider::SuggestResults& results, |
| 114 const TemplateURL* template_url, | 114 const TemplateURL* template_url, |
| 115 SearchProvider::MatchMap* map); | 115 SearchProvider::MatchMap* map); |
| 116 | 116 |
| 117 // Creates an AutocompleteMatch with the provided |relevance| and |type| to | 117 // Creates an AutocompleteMatch with the provided |relevance| and |type| to |
| 118 // search |template_url| for |query_string|. |accepted_suggestion| will be | 118 // search |template_url| for |query_string|. |accepted_suggestion| will be |
| 119 // used to generate Assisted Query Stats. | 119 // used to generate Assisted Query Stats. |
| 120 // | 120 // |
| 121 // Adds this match to |map|; if such a match already exists, whichever one | 121 // Adds this match to |map|; if such a match already exists, whichever one |
| 122 // has lower relevance is eliminated. | 122 // has lower relevance is eliminated. |
| 123 void AddMatchToMap(int relevance, | 123 void AddMatchToMap(const SearchProvider::SuggestResult& result, |
| 124 AutocompleteMatch::Type type, | 124 AutocompleteMatch::Type type, |
| 125 const TemplateURL* template_url, | 125 const TemplateURL* template_url, |
| 126 const string16& query_string, | |
| 127 int accepted_suggestion, | 126 int accepted_suggestion, |
| 128 SearchProvider::MatchMap* map); | 127 SearchProvider::MatchMap* map); |
| 129 | 128 |
| 130 // Returns an AutocompleteMatch for a navigational suggestion |navigation|. | 129 // Returns an AutocompleteMatch for a navigational suggestion |navigation|. |
| 131 AutocompleteMatch NavigationToMatch( | 130 AutocompleteMatch NavigationToMatch( |
| 132 const SearchProvider::NavigationResult& navigation); | 131 const SearchProvider::NavigationResult& navigation); |
| 133 | 132 |
| 134 // Fetches zero-suggest suggestions for |current_query_|. | 133 // Fetches zero-suggest suggestions for |current_query_|. |
| 135 void Run(); | 134 void Run(); |
| 136 | 135 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Whether a zero suggest request triggered a field trial in the omnibox | 181 // Whether a zero suggest request triggered a field trial in the omnibox |
| 183 // session. The user could have clicked on a suggestion when zero suggest | 182 // session. The user could have clicked on a suggestion when zero suggest |
| 184 // triggered (same condition as field_trial_triggered_), or triggered zero | 183 // triggered (same condition as field_trial_triggered_), or triggered zero |
| 185 // suggest but kept typing. | 184 // suggest but kept typing. |
| 186 bool field_trial_triggered_in_session_; | 185 bool field_trial_triggered_in_session_; |
| 187 | 186 |
| 188 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); | 187 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); |
| 189 }; | 188 }; |
| 190 | 189 |
| 191 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 190 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
| OLD | NEW |