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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Returns an AutocompleteMatch with the given |autocomplete_provider| | 329 // Returns an AutocompleteMatch with the given |autocomplete_provider| |
330 // for the search |suggestion|, which represents a search via |template_url|. | 330 // for the search |suggestion|, which represents a search via |template_url|. |
331 // If |template_url| is NULL, returns a match with an invalid destination URL. | 331 // If |template_url| is NULL, returns a match with an invalid destination URL. |
332 // | 332 // |
333 // |input| is the original user input. Text in the input is used to highlight | 333 // |input| is the original user input. Text in the input is used to highlight |
334 // portions of the match contents to distinguish locally-typed text from | 334 // portions of the match contents to distinguish locally-typed text from |
335 // suggested text. | 335 // suggested text. |
336 // | 336 // |
337 // |input| is also necessary for various other details, like whether we should | 337 // |input| is also necessary for various other details, like whether we should |
338 // allow inline autocompletion and what the transition type should be. | 338 // allow inline autocompletion and what the transition type should be. |
339 // |accepted_suggestion| and |omnibox_start_margin| are used to generate | 339 // |accepted_suggestion| is used to generate Assisted Query Stats. |
340 // Assisted Query Stats. | |
341 // |append_extra_query_params| should be set if |template_url| is the default | 340 // |append_extra_query_params| should be set if |template_url| is the default |
342 // search engine, so the destination URL will contain any | 341 // search engine, so the destination URL will contain any |
343 // command-line-specified query params. | 342 // command-line-specified query params. |
344 // |from_app_list| should be set if the search was made from the app list. | 343 // |from_app_list| should be set if the search was made from the app list. |
345 static AutocompleteMatch CreateSearchSuggestion( | 344 static AutocompleteMatch CreateSearchSuggestion( |
346 AutocompleteProvider* autocomplete_provider, | 345 AutocompleteProvider* autocomplete_provider, |
347 const AutocompleteInput& input, | 346 const AutocompleteInput& input, |
348 const SuggestResult& suggestion, | 347 const SuggestResult& suggestion, |
349 const TemplateURL* template_url, | 348 const TemplateURL* template_url, |
350 const SearchTermsData& search_terms_data, | 349 const SearchTermsData& search_terms_data, |
351 int accepted_suggestion, | 350 int accepted_suggestion, |
352 int omnibox_start_margin, | |
353 bool append_extra_query_params, | 351 bool append_extra_query_params, |
354 bool from_app_list); | 352 bool from_app_list); |
355 | 353 |
356 // Parses JSON response received from the provider, stripping XSSI | 354 // Parses JSON response received from the provider, stripping XSSI |
357 // protection if needed. Returns the parsed data if successful, NULL | 355 // protection if needed. Returns the parsed data if successful, NULL |
358 // otherwise. | 356 // otherwise. |
359 static scoped_ptr<base::Value> DeserializeJsonData(std::string json_data); | 357 static scoped_ptr<base::Value> DeserializeJsonData(std::string json_data); |
360 | 358 |
361 // Returns whether the requirements for requesting zero suggest results | 359 // Returns whether the requirements for requesting zero suggest results |
362 // are met. The requirements are | 360 // are met. The requirements are |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 518 |
521 // True if this provider's results are being displayed in the app list. By | 519 // True if this provider's results are being displayed in the app list. By |
522 // default this is false, meaning that the results will be shown in the | 520 // default this is false, meaning that the results will be shown in the |
523 // omnibox. | 521 // omnibox. |
524 bool in_app_list_; | 522 bool in_app_list_; |
525 | 523 |
526 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 524 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
527 }; | 525 }; |
528 | 526 |
529 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 527 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
OLD | NEW |