OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 file contains the Search autocomplete provider. This provider is | 5 // This file contains the Search autocomplete provider. This provider is |
6 // responsible for all autocomplete entries that start with "Search <engine> | 6 // responsible for all autocomplete entries that start with "Search <engine> |
7 // for ...", including searching for the current input string, search | 7 // for ...", including searching for the current input string, search |
8 // history, and search suggestions. An instance of it gets created and | 8 // history, and search suggestions. An instance of it gets created and |
9 // managed by the autocomplete controller. | 9 // managed by the autocomplete controller. |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // matches (either synchronously or asynchronously). | 47 // matches (either synchronously or asynchronously). |
48 // | 48 // |
49 // Initially the provider creates a match that searches for the current input | 49 // Initially the provider creates a match that searches for the current input |
50 // text. It also starts a task to query the Suggest servers. When that data | 50 // text. It also starts a task to query the Suggest servers. When that data |
51 // comes back, the provider creates and returns matches for the best | 51 // comes back, the provider creates and returns matches for the best |
52 // suggestions. | 52 // suggestions. |
53 class SearchProvider : public BaseSearchProvider, | 53 class SearchProvider : public BaseSearchProvider, |
54 public TemplateURLServiceObserver, | 54 public TemplateURLServiceObserver, |
55 public net::URLFetcherDelegate { | 55 public net::URLFetcherDelegate { |
56 public: | 56 public: |
57 SearchProvider(AutocompleteProviderListener* listener, | 57 SearchProvider(AutocompleteProviderClient* client, |
58 TemplateURLService* template_url_service, | 58 AutocompleteProviderListener* listener, |
59 scoped_ptr<AutocompleteProviderClient> client); | 59 TemplateURLService* template_url_service); |
60 | 60 |
61 // Extracts the suggest response metadata which SearchProvider previously | 61 // Extracts the suggest response metadata which SearchProvider previously |
62 // stored for |match|. | 62 // stored for |match|. |
63 static std::string GetSuggestMetadata(const AutocompleteMatch& match); | 63 static std::string GetSuggestMetadata(const AutocompleteMatch& match); |
64 | 64 |
65 // Answers prefetch handling - register displayed answers. Takes the top | 65 // Answers prefetch handling - register displayed answers. Takes the top |
66 // match for Autocomplete and registers the contained answer data, if any. | 66 // match for Autocomplete and registers the contained answer data, if any. |
67 void RegisterDisplayedAnswers(const AutocompleteResult& result); | 67 void RegisterDisplayedAnswers(const AutocompleteResult& result); |
68 | 68 |
69 // AutocompleteProvider: | 69 // AutocompleteProvider: |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 base::TimeTicks token_expiration_time_; | 413 base::TimeTicks token_expiration_time_; |
414 | 414 |
415 // Answers prefetch management. | 415 // Answers prefetch management. |
416 AnswersCache answers_cache_; // Cache for last answers seen. | 416 AnswersCache answers_cache_; // Cache for last answers seen. |
417 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 417 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
418 | 418 |
419 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 419 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
420 }; | 420 }; |
421 | 421 |
422 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ | 422 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ |
OLD | NEW |