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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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: |
70 void ResetSession() override; | 70 void ResetSession() override; |
71 | 71 |
72 // This URL may be sent with suggest requests; see comments on CanSendURL(). | |
73 void set_current_page_url(const GURL& current_page_url) { | |
74 current_page_url_ = current_page_url; | |
75 } | |
76 | |
77 protected: | 72 protected: |
78 ~SearchProvider() override; | 73 ~SearchProvider() override; |
79 | 74 |
80 private: | 75 private: |
81 friend class AutocompleteProviderTest; | 76 friend class AutocompleteProviderTest; |
82 friend class SearchProviderTest; | 77 friend class SearchProviderTest; |
83 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL); | 78 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL); |
84 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, | 79 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, |
85 DontInlineAutocompleteAsynchronously); | 80 DontInlineAutocompleteAsynchronously); |
86 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInline); | 81 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, NavigationInline); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 394 |
400 // Results from the default and keyword search providers. | 395 // Results from the default and keyword search providers. |
401 SearchSuggestionParser::Results default_results_; | 396 SearchSuggestionParser::Results default_results_; |
402 SearchSuggestionParser::Results keyword_results_; | 397 SearchSuggestionParser::Results keyword_results_; |
403 | 398 |
404 // The top query suggestion, left blank if none. | 399 // The top query suggestion, left blank if none. |
405 base::string16 top_query_suggestion_match_contents_; | 400 base::string16 top_query_suggestion_match_contents_; |
406 // The top navigation suggestion, left blank/invalid if none. | 401 // The top navigation suggestion, left blank/invalid if none. |
407 GURL top_navigation_suggestion_; | 402 GURL top_navigation_suggestion_; |
408 | 403 |
409 GURL current_page_url_; | |
410 | |
411 // Session token management. | 404 // Session token management. |
412 std::string current_token_; | 405 std::string current_token_; |
413 base::TimeTicks token_expiration_time_; | 406 base::TimeTicks token_expiration_time_; |
414 | 407 |
415 // Answers prefetch management. | 408 // Answers prefetch management. |
416 AnswersCache answers_cache_; // Cache for last answers seen. | 409 AnswersCache answers_cache_; // Cache for last answers seen. |
417 AnswersQueryData prefetch_data_; // Data to use for query prefetching. | 410 AnswersQueryData prefetch_data_; // Data to use for query prefetching. |
418 | 411 |
419 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 412 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
420 }; | 413 }; |
421 | 414 |
422 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ | 415 #endif // COMPONENTS_OMNIBOX_SEARCH_PROVIDER_H_ |
OLD | NEW |