Index: chrome/browser/autocomplete/search_provider.h |
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h |
index 023fd33c9e78ccd4c23de8d15a22294bec8ac30c..8fa3d7840956d3244ea45ed9486f2937fc83c3f1 100644 |
--- a/chrome/browser/autocomplete/search_provider.h |
+++ b/chrome/browser/autocomplete/search_provider.h |
@@ -19,7 +19,9 @@ |
#include "chrome/browser/autocomplete/base_search_provider.h" |
#include "components/metrics/proto/omnibox_input_type.pb.h" |
#include "components/search_engines/template_url.h" |
+#include "net/url_request/url_fetcher_delegate.h" |
+class AutocompleteProviderListener; |
class AutocompleteResult; |
class Profile; |
class SearchProviderTest; |
@@ -43,7 +45,8 @@ class URLFetcher; |
// text. It also starts a task to query the Suggest servers. When that data |
// comes back, the provider creates and returns matches for the best |
// suggestions. |
-class SearchProvider : public BaseSearchProvider { |
+class SearchProvider : public BaseSearchProvider, |
+ public net::URLFetcherDelegate { |
public: |
SearchProvider(AutocompleteProviderListener* listener, |
TemplateURLService* template_url_service, |
@@ -163,22 +166,24 @@ class SearchProvider : public BaseSearchProvider { |
virtual void Start(const AutocompleteInput& input, |
bool minimal_changes) OVERRIDE; |
+ // Called after ParseSuggestResults to rank the |results|. |
+ void SortResults(bool is_keyword, SearchSuggestionParser::Results* results); |
Peter Kasting
2014/08/08 17:33:23
Nit: Move this down below the virtual functions (a
hashimoto
2014/08/11 05:15:04
Done.
|
+ |
// BaseSearchProvider: |
- virtual void SortResults(bool is_keyword, |
- SearchSuggestionParser::Results* results) OVERRIDE; |
virtual const TemplateURL* GetTemplateURL(bool is_keyword) const OVERRIDE; |
virtual const AutocompleteInput GetInput(bool is_keyword) const OVERRIDE; |
- virtual SearchSuggestionParser::Results* GetResultsToFill( |
- bool is_keyword) OVERRIDE; |
virtual bool ShouldAppendExtraParams( |
const SearchSuggestionParser::SuggestResult& result) const OVERRIDE; |
virtual void StopSuggest() OVERRIDE; |
virtual void ClearAllResults() OVERRIDE; |
- virtual int GetDefaultResultRelevance() const OVERRIDE; |
virtual void RecordDeletionResult(bool success) OVERRIDE; |
- virtual void LogFetchComplete(bool success, bool is_keyword) OVERRIDE; |
- virtual bool IsKeywordFetcher(const net::URLFetcher* fetcher) const OVERRIDE; |
- virtual void UpdateMatches() OVERRIDE; |
+ |
+ // Records UMA statistics about a suggest server response. |
+ void LogFetchComplete(bool success, bool is_keyword); |
+ |
+ // Updates |matches_| from the latest results; applies calculated relevances |
+ // if suggested relevances cause undesriable behavior. Updates |done_|. |
Peter Kasting
2014/08/08 17:33:24
Nit undesirable
hashimoto
2014/08/11 05:15:04
Done.
|
+ void UpdateMatches(); |
// Called when timer_ expires. |
void Run(); |
@@ -214,6 +219,9 @@ class SearchProvider : public BaseSearchProvider { |
const TemplateURL* template_url, |
const AutocompleteInput& input); |
+ // net::URLFetcherDelegate: |
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
Peter Kasting
2014/08/08 17:33:23
Nit: Move this up to be with the other virtual fun
hashimoto
2014/08/11 05:15:04
Done.
|
+ |
// Converts the parsed results to a set of AutocompleteMatches, |matches_|. |
void ConvertResultsToAutocompleteMatches(); |
@@ -307,6 +315,12 @@ class SearchProvider : public BaseSearchProvider { |
// previous one. Non-const because some unittests modify this value. |
static int kMinimumTimeBetweenSuggestQueriesMs; |
+ AutocompleteProviderListener* listener_; |
+ |
+ // The number of suggest results that haven't yet arrived. If it's greater |
+ // than 0, it indicates that one of the URLFetchers is still running. |
+ int suggest_results_pending_; |
+ |
// Maintains the TemplateURLs used. |
Providers providers_; |