| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 void AddSuggestResultsToMap(const SearchProvider::SuggestResults& results, | 109 void AddSuggestResultsToMap(const SearchProvider::SuggestResults& results, |
| 110 const TemplateURL* template_url, | 110 const TemplateURL* template_url, |
| 111 SearchProvider::MatchMap* map); | 111 SearchProvider::MatchMap* map); |
| 112 | 112 |
| 113 // Creates an AutocompleteMatch with the provided |relevance| and |type| to | 113 // Creates an AutocompleteMatch with the provided |relevance| and |type| to |
| 114 // search |template_url| for |query_string|. |accepted_suggestion| will be | 114 // search |template_url| for |query_string|. |accepted_suggestion| will be |
| 115 // used to generate Assisted Query Stats. | 115 // used to generate Assisted Query Stats. |
| 116 // | 116 // |
| 117 // Adds this match to |map|; if such a match already exists, whichever one | 117 // Adds this match to |map|; if such a match already exists, whichever one |
| 118 // has lower relevance is eliminated. | 118 // has lower relevance is eliminated. |
| 119 void AddMatchToMap(int relevance, | 119 void AddMatchToMap(const SearchProvider::SuggestResult& result, |
| 120 AutocompleteMatch::Type type, | 120 AutocompleteMatch::Type type, |
| 121 const TemplateURL* template_url, | 121 const TemplateURL* template_url, |
| 122 const string16& query_string, | |
| 123 int accepted_suggestion, | 122 int accepted_suggestion, |
| 124 SearchProvider::MatchMap* map); | 123 SearchProvider::MatchMap* map); |
| 125 | 124 |
| 126 // Returns an AutocompleteMatch for a navigational suggestion |navigation|. | 125 // Returns an AutocompleteMatch for a navigational suggestion |navigation|. |
| 127 AutocompleteMatch NavigationToMatch( | 126 AutocompleteMatch NavigationToMatch( |
| 128 const SearchProvider::NavigationResult& navigation); | 127 const SearchProvider::NavigationResult& navigation); |
| 129 | 128 |
| 130 // Fetches zero-suggest suggestions for |current_query_|. | 129 // Fetches zero-suggest suggestions for |current_query_|. |
| 131 void Run(); | 130 void Run(); |
| 132 | 131 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Whether a zero suggest request triggered a field trial in the omnibox | 177 // Whether a zero suggest request triggered a field trial in the omnibox |
| 179 // session. The user could have clicked on a suggestion when zero suggest | 178 // session. The user could have clicked on a suggestion when zero suggest |
| 180 // triggered (same condition as field_trial_triggered_), or triggered zero | 179 // triggered (same condition as field_trial_triggered_), or triggered zero |
| 181 // suggest but kept typing. | 180 // suggest but kept typing. |
| 182 bool field_trial_triggered_in_session_; | 181 bool field_trial_triggered_in_session_; |
| 183 | 182 |
| 184 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); | 183 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); |
| 185 }; | 184 }; |
| 186 | 185 |
| 187 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 186 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
| OLD | NEW |