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 27 matching lines...) Expand all Loading... |
38 // After construction, the autocomplete controller repeatedly calls Start() | 38 // After construction, the autocomplete controller repeatedly calls Start() |
39 // with some user input, each time expecting to receive a small set of the best | 39 // with some user input, each time expecting to receive a small set of the best |
40 // matches (either synchronously or asynchronously). | 40 // matches (either synchronously or asynchronously). |
41 // | 41 // |
42 // Initially the provider creates a match that searches for the current input | 42 // Initially the provider creates a match that searches for the current input |
43 // text. It also starts a task to query the Suggest servers. When that data | 43 // text. It also starts a task to query the Suggest servers. When that data |
44 // comes back, the provider creates and returns matches for the best | 44 // comes back, the provider creates and returns matches for the best |
45 // suggestions. | 45 // suggestions. |
46 class SearchProvider : public BaseSearchProvider { | 46 class SearchProvider : public BaseSearchProvider { |
47 public: | 47 public: |
48 SearchProvider(AutocompleteProviderListener* listener, Profile* profile); | 48 SearchProvider(AutocompleteProviderListener* listener, |
| 49 TemplateURLService* template_url_service, |
| 50 Profile* profile); |
49 | 51 |
50 // Extracts the suggest response metadata which SearchProvider previously | 52 // Extracts the suggest response metadata which SearchProvider previously |
51 // stored for |match|. | 53 // stored for |match|. |
52 static std::string GetSuggestMetadata(const AutocompleteMatch& match); | 54 static std::string GetSuggestMetadata(const AutocompleteMatch& match); |
53 | 55 |
54 // Answers prefetch handling - register displayed answers. Takes the top | 56 // Answers prefetch handling - register displayed answers. Takes the top |
55 // match for Autocomplete and registers the contained answer data, if any. | 57 // match for Autocomplete and registers the contained answer data, if any. |
56 void RegisterDisplayedAnswers(const AutocompleteResult& result); | 58 void RegisterDisplayedAnswers(const AutocompleteResult& result); |
57 | 59 |
58 // AutocompleteProvider: | 60 // AutocompleteProvider: |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 base::TimeTicks token_expiration_time_; | 342 base::TimeTicks token_expiration_time_; |
341 | 343 |
342 // Answers prefetch management. | 344 // Answers prefetch management. |
343 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 345 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
344 AnswersQueryData last_answer_seen_; // Last answer seen. | 346 AnswersQueryData last_answer_seen_; // Last answer seen. |
345 | 347 |
346 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 348 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
347 }; | 349 }; |
348 | 350 |
349 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 351 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |