| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 MatchMap* map); | 426 MatchMap* map); |
| 426 | 427 |
| 427 // Parses results from the suggest server and updates the appropriate suggest | 428 // Parses results from the suggest server and updates the appropriate suggest |
| 428 // and navigation result lists in |results|. |is_keyword_result| indicates | 429 // and navigation result lists in |results|. |is_keyword_result| indicates |
| 429 // whether the response was received from the keyword provider. | 430 // whether the response was received from the keyword provider. |
| 430 // Returns whether the appropriate result list members were updated. | 431 // Returns whether the appropriate result list members were updated. |
| 431 bool ParseSuggestResults(const base::Value& root_val, | 432 bool ParseSuggestResults(const base::Value& root_val, |
| 432 bool is_keyword_result, | 433 bool is_keyword_result, |
| 433 Results* results); | 434 Results* results); |
| 434 | 435 |
| 436 // Prefetches any images in Answers results. |
| 437 void PrefetchAnswersImages(const base::DictionaryValue* answers_json); |
| 438 |
| 435 // Called at the end of ParseSuggestResults to rank the |results|. | 439 // Called at the end of ParseSuggestResults to rank the |results|. |
| 436 virtual void SortResults(bool is_keyword, | 440 virtual void SortResults(bool is_keyword, |
| 437 const base::ListValue* relevances, | 441 const base::ListValue* relevances, |
| 438 Results* results); | 442 Results* results); |
| 439 | 443 |
| 440 // Optionally, cache the received |json_data| and return true if we want | 444 // Optionally, cache the received |json_data| and return true if we want |
| 441 // to stop processing results at this point. The |parsed_data| is the parsed | 445 // to stop processing results at this point. The |parsed_data| is the parsed |
| 442 // version of |json_data| used to determine if we received an empty result. | 446 // version of |json_data| used to determine if we received an empty result. |
| 443 virtual bool StoreSuggestionResponse(const std::string& json_data, | 447 virtual bool StoreSuggestionResponse(const std::string& json_data, |
| 444 const base::Value& parsed_data); | 448 const base::Value& parsed_data); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 523 |
| 520 // True if this provider's results are being displayed in the app list. By | 524 // True if this provider's results are being displayed in the app list. By |
| 521 // default this is false, meaning that the results will be shown in the | 525 // default this is false, meaning that the results will be shown in the |
| 522 // omnibox. | 526 // omnibox. |
| 523 bool in_app_list_; | 527 bool in_app_list_; |
| 524 | 528 |
| 525 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); | 529 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); |
| 526 }; | 530 }; |
| 527 | 531 |
| 528 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ | 532 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ |
| OLD | NEW |