| 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 21 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 22 #include "net/url_request/url_fetcher_delegate.h" | 22 #include "net/url_request/url_fetcher_delegate.h" |
| 23 | 23 |
| 24 class AutocompleteProviderListener; | 24 class AutocompleteProviderListener; |
| 25 class GURL; | 25 class GURL; |
| 26 class Profile; | 26 class Profile; |
| 27 class SuggestionDeletionHandler; | 27 class SuggestionDeletionHandler; |
| 28 class TemplateURL; | 28 class TemplateURL; |
| 29 | 29 |
| 30 namespace base { | 30 namespace base { |
| 31 class DictionaryValue; |
| 31 class ListValue; | 32 class ListValue; |
| 32 class Value; | 33 class Value; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // Base functionality for receiving suggestions from a search engine. | 36 // Base functionality for receiving suggestions from a search engine. |
| 36 // This class is abstract and should only be used as a base for other | 37 // This class is abstract and should only be used as a base for other |
| 37 // autocomplete providers utilizing its functionality. | 38 // autocomplete providers utilizing its functionality. |
| 38 class BaseSearchProvider : public AutocompleteProvider, | 39 class BaseSearchProvider : public AutocompleteProvider, |
| 39 public net::URLFetcherDelegate { | 40 public net::URLFetcherDelegate { |
| 40 public: | 41 public: |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 MatchMap* map); | 428 MatchMap* map); |
| 428 | 429 |
| 429 // Parses results from the suggest server and updates the appropriate suggest | 430 // Parses results from the suggest server and updates the appropriate suggest |
| 430 // and navigation result lists in |results|. |is_keyword_result| indicates | 431 // and navigation result lists in |results|. |is_keyword_result| indicates |
| 431 // whether the response was received from the keyword provider. | 432 // whether the response was received from the keyword provider. |
| 432 // Returns whether the appropriate result list members were updated. | 433 // Returns whether the appropriate result list members were updated. |
| 433 bool ParseSuggestResults(const base::Value& root_val, | 434 bool ParseSuggestResults(const base::Value& root_val, |
| 434 bool is_keyword_result, | 435 bool is_keyword_result, |
| 435 Results* results); | 436 Results* results); |
| 436 | 437 |
| 438 // Prefetches any images in Answers results. |
| 439 void PrefetchAnswersImages(const base::DictionaryValue* answers_json); |
| 440 |
| 437 // Called at the end of ParseSuggestResults to rank the |results|. | 441 // Called at the end of ParseSuggestResults to rank the |results|. |
| 438 virtual void SortResults(bool is_keyword, | 442 virtual void SortResults(bool is_keyword, |
| 439 const base::ListValue* relevances, | 443 const base::ListValue* relevances, |
| 440 Results* results); | 444 Results* results); |
| 441 | 445 |
| 442 // Optionally, cache the received |json_data| and return true if we want | 446 // Optionally, cache the received |json_data| and return true if we want |
| 443 // to stop processing results at this point. The |parsed_data| is the parsed | 447 // to stop processing results at this point. The |parsed_data| is the parsed |
| 444 // version of |json_data| used to determine if we received an empty result. | 448 // version of |json_data| used to determine if we received an empty result. |
| 445 virtual bool StoreSuggestionResponse(const std::string& json_data, | 449 virtual bool StoreSuggestionResponse(const std::string& json_data, |
| 446 const base::Value& parsed_data); | 450 const base::Value& parsed_data); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 525 |
| 522 // True if this provider's results are being displayed in the app list. By | 526 // True if this provider's results are being displayed in the app list. By |
| 523 // default this is false, meaning that the results will be shown in the | 527 // default this is false, meaning that the results will be shown in the |
| 524 // omnibox. | 528 // omnibox. |
| 525 bool in_app_list_; | 529 bool in_app_list_; |
| 526 | 530 |
| 527 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 531 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
| 528 }; | 532 }; |
| 529 | 533 |
| 530 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 534 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
| OLD | NEW |