| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 DontInlineAutocompleteAsynchronously); | 82 DontInlineAutocompleteAsynchronously); |
| 83 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInline); | 83 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInline); |
| 84 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineDomainClassify); | 84 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineDomainClassify); |
| 85 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineSchemeSubstring); | 85 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineSchemeSubstring); |
| 86 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestRelevanceExperiment); | 86 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestRelevanceExperiment); |
| 87 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, TestDeleteMatch); | 87 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, TestDeleteMatch); |
| 88 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestQueryUsesToken); | 88 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestQueryUsesToken); |
| 89 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SessionToken); | 89 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SessionToken); |
| 90 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, AnswersCache); | 90 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, AnswersCache); |
| 91 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, RemoveExtraAnswers); | 91 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, RemoveExtraAnswers); |
| 92 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, DoesNotProvideOnFocus); |
| 92 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, GetDestinationURL); | 93 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, GetDestinationURL); |
| 93 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, ClearPrefetchedResults); | 94 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, ClearPrefetchedResults); |
| 94 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, SetPrefetchQuery); | 95 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, SetPrefetchQuery); |
| 95 | 96 |
| 96 // Manages the providers (TemplateURLs) used by SearchProvider. Two providers | 97 // Manages the providers (TemplateURLs) used by SearchProvider. Two providers |
| 97 // may be used: | 98 // may be used: |
| 98 // . The default provider. This corresponds to the user's default search | 99 // . The default provider. This corresponds to the user's default search |
| 99 // engine. This is always used, except for the rare case of no default | 100 // engine. This is always used, except for the rare case of no default |
| 100 // engine. | 101 // engine. |
| 101 // . The keyword provider. This is used if the user has typed in a keyword. | 102 // . The keyword provider. This is used if the user has typed in a keyword. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool prefer_keyword); | 152 bool prefer_keyword); |
| 152 | 153 |
| 153 // A helper function for UpdateAllOldResults(). | 154 // A helper function for UpdateAllOldResults(). |
| 154 static void UpdateOldResults(bool minimal_changes, | 155 static void UpdateOldResults(bool minimal_changes, |
| 155 SearchSuggestionParser::Results* results); | 156 SearchSuggestionParser::Results* results); |
| 156 | 157 |
| 157 // Returns the first match in |matches| which might be chosen as default. | 158 // Returns the first match in |matches| which might be chosen as default. |
| 158 static ACMatches::iterator FindTopMatch(ACMatches* matches); | 159 static ACMatches::iterator FindTopMatch(ACMatches* matches); |
| 159 | 160 |
| 160 // AutocompleteProvider: | 161 // AutocompleteProvider: |
| 161 void Start(const AutocompleteInput& input, bool minimal_changes) override; | 162 void Start(const AutocompleteInput& input, |
| 163 bool minimal_changes, |
| 164 bool called_due_to_focus) override; |
| 162 void Stop(bool clear_cached_results) override; | 165 void Stop(bool clear_cached_results) override; |
| 163 | 166 |
| 164 // BaseSearchProvider: | 167 // BaseSearchProvider: |
| 165 const TemplateURL* GetTemplateURL(bool is_keyword) const override; | 168 const TemplateURL* GetTemplateURL(bool is_keyword) const override; |
| 166 const AutocompleteInput GetInput(bool is_keyword) const override; | 169 const AutocompleteInput GetInput(bool is_keyword) const override; |
| 167 bool ShouldAppendExtraParams( | 170 bool ShouldAppendExtraParams( |
| 168 const SearchSuggestionParser::SuggestResult& result) const override; | 171 const SearchSuggestionParser::SuggestResult& result) const override; |
| 169 void RecordDeletionResult(bool success) override; | 172 void RecordDeletionResult(bool success) override; |
| 170 | 173 |
| 171 // net::URLFetcherDelegate: | 174 // net::URLFetcherDelegate: |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 base::TimeTicks token_expiration_time_; | 397 base::TimeTicks token_expiration_time_; |
| 395 | 398 |
| 396 // Answers prefetch management. | 399 // Answers prefetch management. |
| 397 AnswersCache answers_cache_; // Cache for last answers seen. | 400 AnswersCache answers_cache_; // Cache for last answers seen. |
| 398 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 401 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
| 399 | 402 |
| 400 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 403 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 401 }; | 404 }; |
| 402 | 405 |
| 403 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ | 406 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ |
| OLD | NEW |