OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 class contains common functionality for search-based autocomplete | 5 // This class contains common functionality for search-based autocomplete |
6 // providers. Search provider and zero suggest provider both use it for common | 6 // providers. Search provider and zero suggest provider both use it for common |
7 // functionality. | 7 // functionality. |
8 | 8 |
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 std::string deletion_url_; | 170 std::string deletion_url_; |
171 }; | 171 }; |
172 | 172 |
173 class SuggestResult : public Result { | 173 class SuggestResult : public Result { |
174 public: | 174 public: |
175 SuggestResult(const base::string16& suggestion, | 175 SuggestResult(const base::string16& suggestion, |
176 AutocompleteMatchType::Type type, | 176 AutocompleteMatchType::Type type, |
177 const base::string16& match_contents, | 177 const base::string16& match_contents, |
178 const base::string16& match_contents_prefix, | 178 const base::string16& match_contents_prefix, |
179 const base::string16& annotation, | 179 const base::string16& annotation, |
| 180 const base::string16& answer_contents, |
| 181 const base::string16& answer_type, |
180 const std::string& suggest_query_params, | 182 const std::string& suggest_query_params, |
181 const std::string& deletion_url, | 183 const std::string& deletion_url, |
182 bool from_keyword_provider, | 184 bool from_keyword_provider, |
183 int relevance, | 185 int relevance, |
184 bool relevance_from_server, | 186 bool relevance_from_server, |
185 bool should_prefetch, | 187 bool should_prefetch, |
186 const base::string16& input_text); | 188 const base::string16& input_text); |
187 virtual ~SuggestResult(); | 189 virtual ~SuggestResult(); |
188 | 190 |
189 const base::string16& suggestion() const { return suggestion_; } | 191 const base::string16& suggestion() const { return suggestion_; } |
190 const base::string16& match_contents_prefix() const { | 192 const base::string16& match_contents_prefix() const { |
191 return match_contents_prefix_; | 193 return match_contents_prefix_; |
192 } | 194 } |
193 const base::string16& annotation() const { return annotation_; } | 195 const base::string16& annotation() const { return annotation_; } |
194 const std::string& suggest_query_params() const { | 196 const std::string& suggest_query_params() const { |
195 return suggest_query_params_; | 197 return suggest_query_params_; |
196 } | 198 } |
| 199 |
| 200 const base::string16& answer_contents() const { return answer_contents_; } |
| 201 const base::string16& answer_type() const { return answer_type_; } |
| 202 |
197 bool should_prefetch() const { return should_prefetch_; } | 203 bool should_prefetch() const { return should_prefetch_; } |
198 | 204 |
199 // Fills in |match_contents_class_| to reflect how |match_contents_| should | 205 // Fills in |match_contents_class_| to reflect how |match_contents_| should |
200 // be displayed and bolded against the current |input_text|. If | 206 // be displayed and bolded against the current |input_text|. If |
201 // |allow_bolding_all| is false and |match_contents_class_| would have all | 207 // |allow_bolding_all| is false and |match_contents_class_| would have all |
202 // of |match_contents_| bolded, do nothing. | 208 // of |match_contents_| bolded, do nothing. |
203 void ClassifyMatchContents(const bool allow_bolding_all, | 209 void ClassifyMatchContents(const bool allow_bolding_all, |
204 const base::string16& input_text); | 210 const base::string16& input_text); |
205 | 211 |
206 // Result: | 212 // Result: |
(...skipping 13 matching lines...) Expand all Loading... |
220 base::string16 match_contents_prefix_; | 226 base::string16 match_contents_prefix_; |
221 | 227 |
222 // Optional annotation for the |match_contents_| for disambiguation. | 228 // Optional annotation for the |match_contents_| for disambiguation. |
223 // This may be displayed in the autocomplete match contents, but is defined | 229 // This may be displayed in the autocomplete match contents, but is defined |
224 // separately to facilitate different formatting. | 230 // separately to facilitate different formatting. |
225 base::string16 annotation_; | 231 base::string16 annotation_; |
226 | 232 |
227 // Optional additional parameters to be added to the search URL. | 233 // Optional additional parameters to be added to the search URL. |
228 std::string suggest_query_params_; | 234 std::string suggest_query_params_; |
229 | 235 |
| 236 // Optional formatted Answers result. |
| 237 base::string16 answer_contents_; |
| 238 |
| 239 // Type of optional formatted Answers result. |
| 240 base::string16 answer_type_; |
| 241 |
230 // Should this result be prefetched? | 242 // Should this result be prefetched? |
231 bool should_prefetch_; | 243 bool should_prefetch_; |
232 }; | 244 }; |
233 | 245 |
234 class NavigationResult : public Result { | 246 class NavigationResult : public Result { |
235 public: | 247 public: |
236 // |provider| is necessary to use StringForURLDisplay() in order to | 248 // |provider| is necessary to use StringForURLDisplay() in order to |
237 // compute |formatted_url_|. | 249 // compute |formatted_url_|. |
238 NavigationResult(const AutocompleteProvider& provider, | 250 NavigationResult(const AutocompleteProvider& provider, |
239 const GURL& url, | 251 const GURL& url, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 519 |
508 // True if this provider's results are being displayed in the app list. By | 520 // True if this provider's results are being displayed in the app list. By |
509 // default this is false, meaning that the results will be shown in the | 521 // default this is false, meaning that the results will be shown in the |
510 // omnibox. | 522 // omnibox. |
511 bool in_app_list_; | 523 bool in_app_list_; |
512 | 524 |
513 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 525 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
514 }; | 526 }; |
515 | 527 |
516 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 528 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
OLD | NEW |