Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: chrome/browser/autocomplete/zero_suggest_provider.h

Issue 17022004: Replace --google-base-suggest-url and --instant-url with --google-base-url. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // From the OpenSearch formatted response |root_val|, populate query 95 // From the OpenSearch formatted response |root_val|, populate query
96 // suggestions into |suggest_results|, navigation suggestions into 96 // suggestions into |suggest_results|, navigation suggestions into
97 // |navigation_results|, and the verbatim relevance score into 97 // |navigation_results|, and the verbatim relevance score into
98 // |verbatim_relevance|. 98 // |verbatim_relevance|.
99 void FillResults(const base::Value& root_val, 99 void FillResults(const base::Value& root_val,
100 int* verbatim_relevance, 100 int* verbatim_relevance,
101 SearchProvider::SuggestResults* suggest_results, 101 SearchProvider::SuggestResults* suggest_results,
102 SearchProvider::NavigationResults* navigation_results); 102 SearchProvider::NavigationResults* navigation_results);
103 103
104 // Creates AutocompleteMatches for "Search |provider_keyword| for 104 // Creates AutocompleteMatches to search |template_url| for "<suggestion>" for
105 // <suggestion>" for all suggestions in |results|, and adds them to |map|. 105 // all suggestions in |results|, and adds them to |map|.
106 void AddSuggestResultsToMap(const SearchProvider::SuggestResults& results, 106 void AddSuggestResultsToMap(const SearchProvider::SuggestResults& results,
107 const string16& provider_keyword, 107 const TemplateURL* template_url,
108 SearchProvider::MatchMap* map); 108 SearchProvider::MatchMap* map);
109 109
110 // Creates an AutocompleteMatch for "Search |provider_keyword| for 110 // Creates an AutocompleteMatch with the provided |relevance| and |type| to
111 // |query_string|". The supplied |relevance| and |type| and 111 // search |template_url| for |query_string|. |accepted_suggestion| will be
112 // |accepted_suggestion| will also be used to create the AutocompleteMatch. 112 // used to generate Assisted Query Stats.
113 //
113 // Adds this match to |map|; if such a match already exists, whichever one 114 // Adds this match to |map|; if such a match already exists, whichever one
114 // has lower relevance is eliminated. 115 // has lower relevance is eliminated.
115 void AddMatchToMap(const string16& query_string, 116 void AddMatchToMap(int relevance,
116 const string16& provider_keyword,
117 int relevance,
118 AutocompleteMatch::Type type, 117 AutocompleteMatch::Type type,
118 const TemplateURL* template_url,
119 const string16& query_string,
119 int accepted_suggestion, 120 int accepted_suggestion,
120 SearchProvider::MatchMap* map); 121 SearchProvider::MatchMap* map);
121 122
122 // Returns an AutocompleteMatch for a navigational suggestion |navigation|. 123 // Returns an AutocompleteMatch for a navigational suggestion |navigation|.
123 AutocompleteMatch NavigationToMatch( 124 AutocompleteMatch NavigationToMatch(
124 const SearchProvider::NavigationResult& navigation); 125 const SearchProvider::NavigationResult& navigation);
125 126
126 // Fetches zero-suggest suggestions for |current_query_|. 127 // Fetches zero-suggest suggestions for |current_query_|.
127 void Run(); 128 void Run();
128 129
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Whether a zero suggest request triggered a field trial in the omnibox 171 // Whether a zero suggest request triggered a field trial in the omnibox
171 // session. The user could have clicked on a suggestion when zero suggest 172 // session. The user could have clicked on a suggestion when zero suggest
172 // triggered (same condition as field_trial_triggered_), or triggered zero 173 // triggered (same condition as field_trial_triggered_), or triggered zero
173 // suggest but kept typing. 174 // suggest but kept typing.
174 bool field_trial_triggered_in_session_; 175 bool field_trial_triggered_in_session_;
175 176
176 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); 177 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider);
177 }; 178 };
178 179
179 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 180 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | chrome/browser/autocomplete/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698