Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 protected: | 57 protected: |
| 58 virtual ~SearchProvider(); | 58 virtual ~SearchProvider(); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 friend class SearchProviderTest; | 61 friend class SearchProviderTest; |
| 62 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL); | 62 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL); |
| 63 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInline); | 63 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInline); |
| 64 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineDomainClassify); | 64 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineDomainClassify); |
| 65 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineSchemeSubstring); | 65 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInlineSchemeSubstring); |
| 66 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, RemoveStaleResultsTest); | 66 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, RemoveStaleResultsTest); |
| 67 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SessionToken); | |
|
Peter Kasting
2014/05/09 21:35:07
Nit: List tests here in the same order as the test
groby-ooo-7-16
2014/05/09 21:50:25
Ah. I assumed alphabetical order.
groby-ooo-7-16
2014/05/09 22:18:09
Done.
| |
| 68 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestQueryUsesToken); | |
| 67 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestRelevanceExperiment); | 69 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, SuggestRelevanceExperiment); |
| 68 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, TestDeleteMatch); | 70 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, TestDeleteMatch); |
| 69 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, GetDestinationURL); | 71 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, GetDestinationURL); |
| 70 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, ClearPrefetchedResults); | 72 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, ClearPrefetchedResults); |
| 71 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, SetPrefetchQuery); | 73 FRIEND_TEST_ALL_PREFIXES(InstantExtendedPrefetchTest, SetPrefetchQuery); |
| 72 | 74 |
| 73 // Manages the providers (TemplateURLs) used by SearchProvider. Two providers | 75 // Manages the providers (TemplateURLs) used by SearchProvider. Two providers |
| 74 // may be used: | 76 // may be used: |
| 75 // . The default provider. This corresponds to the user's default search | 77 // . The default provider. This corresponds to the user's default search |
| 76 // engine. This is always used, except for the rare case of no default | 78 // engine. This is always used, except for the rare case of no default |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 bool is_keyword, | 265 bool is_keyword, |
| 264 bool use_aggressive_method, | 266 bool use_aggressive_method, |
| 265 bool prevent_search_history_inlining) const; | 267 bool prevent_search_history_inlining) const; |
| 266 | 268 |
| 267 // Returns an AutocompleteMatch for a navigational suggestion. | 269 // Returns an AutocompleteMatch for a navigational suggestion. |
| 268 AutocompleteMatch NavigationToMatch(const NavigationResult& navigation); | 270 AutocompleteMatch NavigationToMatch(const NavigationResult& navigation); |
| 269 | 271 |
| 270 // Updates the value of |done_| from the internal state. | 272 // Updates the value of |done_| from the internal state. |
| 271 void UpdateDone(); | 273 void UpdateDone(); |
| 272 | 274 |
| 275 // Obtain a session token, regenerating if necessary. | |
|
Peter Kasting
2014/05/09 21:35:07
Nit: Obtains
groby-ooo-7-16
2014/05/09 22:18:09
Done.
| |
| 276 std::string GetSessionToken(); | |
| 277 | |
| 273 // The amount of time to wait before sending a new suggest request after the | 278 // The amount of time to wait before sending a new suggest request after the |
| 274 // previous one. Non-const because some unittests modify this value. | 279 // previous one. Non-const because some unittests modify this value. |
| 275 static int kMinimumTimeBetweenSuggestQueriesMs; | 280 static int kMinimumTimeBetweenSuggestQueriesMs; |
| 276 | 281 |
| 277 // Maintains the TemplateURLs used. | 282 // Maintains the TemplateURLs used. |
| 278 Providers providers_; | 283 Providers providers_; |
| 279 | 284 |
| 280 // The user's input. | 285 // The user's input. |
| 281 AutocompleteInput input_; | 286 AutocompleteInput input_; |
| 282 | 287 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 297 // Fetchers used to retrieve results for the keyword and default providers. | 302 // Fetchers used to retrieve results for the keyword and default providers. |
| 298 scoped_ptr<net::URLFetcher> keyword_fetcher_; | 303 scoped_ptr<net::URLFetcher> keyword_fetcher_; |
| 299 scoped_ptr<net::URLFetcher> default_fetcher_; | 304 scoped_ptr<net::URLFetcher> default_fetcher_; |
| 300 | 305 |
| 301 // Results from the default and keyword search providers. | 306 // Results from the default and keyword search providers. |
| 302 Results default_results_; | 307 Results default_results_; |
| 303 Results keyword_results_; | 308 Results keyword_results_; |
| 304 | 309 |
| 305 GURL current_page_url_; | 310 GURL current_page_url_; |
| 306 | 311 |
| 312 // Session token management. | |
| 313 std::string current_token_; | |
| 314 base::Time token_expiration_time_; | |
| 315 | |
| 307 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 316 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
| 308 }; | 317 }; |
| 309 | 318 |
| 310 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 319 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
| OLD | NEW |