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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // Vector-style accessors/operators. | 555 // Vector-style accessors/operators. |
556 size_t size() const; | 556 size_t size() const; |
557 bool empty() const; | 557 bool empty() const; |
558 const_iterator begin() const; | 558 const_iterator begin() const; |
559 iterator begin(); | 559 iterator begin(); |
560 const_iterator end() const; | 560 const_iterator end() const; |
561 iterator end(); | 561 iterator end(); |
562 | 562 |
563 // Returns the match at the given index. | 563 // Returns the match at the given index. |
564 const AutocompleteMatch& match_at(size_t index) const; | 564 const AutocompleteMatch& match_at(size_t index) const; |
| 565 AutocompleteMatch* match_at(size_t index); |
565 | 566 |
566 // Get the default match for the query (not necessarily the first). Returns | 567 // Get the default match for the query (not necessarily the first). Returns |
567 // end() if there is no default match. | 568 // end() if there is no default match. |
568 const_iterator default_match() const { return default_match_; } | 569 const_iterator default_match() const { return default_match_; } |
569 | 570 |
570 GURL alternate_nav_url() const { return alternate_nav_url_; } | 571 GURL alternate_nav_url() const { return alternate_nav_url_; } |
571 | 572 |
572 // Clears the matches for this result set. | 573 // Clears the matches for this result set. |
573 void Reset(); | 574 void Reset(); |
574 | 575 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 // of various providers. In turn, calls | 726 // of various providers. In turn, calls |
726 // AutocompleteProvider::AddProviderInfo() so each provider can add | 727 // AutocompleteProvider::AddProviderInfo() so each provider can add |
727 // provider-specific information, information we want to log for a | 728 // provider-specific information, information we want to log for a |
728 // particular provider but not others. | 729 // particular provider but not others. |
729 void AddProvidersInfo(ProvidersInfo* provider_info) const; | 730 void AddProvidersInfo(ProvidersInfo* provider_info) const; |
730 | 731 |
731 private: | 732 private: |
732 friend class AutocompleteProviderTest; | 733 friend class AutocompleteProviderTest; |
733 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, | 734 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, |
734 RedundantKeywordsIgnoredInResult); | 735 RedundantKeywordsIgnoredInResult); |
| 736 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, UpdateAssistedQueryStats); |
735 | 737 |
736 // Updates |result_| to reflect the current provider state. Resets timers and | 738 // Updates |result_| to reflect the current provider state. Resets timers and |
737 // fires notifications as necessary. |is_synchronous_pass| is true only when | 739 // fires notifications as necessary. |is_synchronous_pass| is true only when |
738 // Start() is calling this to get the synchronous result. | 740 // Start() is calling this to get the synchronous result. |
739 void UpdateResult(bool is_synchronous_pass); | 741 void UpdateResult(bool is_synchronous_pass); |
740 | 742 |
741 // Updates |result| to populate each match's |associated_keyword| if that | 743 // Updates |result| to populate each match's |associated_keyword| if that |
742 // match can show a keyword hint. |result| should be sorted by | 744 // match can show a keyword hint. |result| should be sorted by |
743 // relevance before this is called. | 745 // relevance before this is called. |
744 void UpdateAssociatedKeywords(AutocompleteResult* result); | 746 void UpdateAssociatedKeywords(AutocompleteResult* result); |
745 | 747 |
746 // For each group of contiguous matches from the same TemplateURL, show the | 748 // For each group of contiguous matches from the same TemplateURL, show the |
747 // provider name as a description on the first match in the group. | 749 // provider name as a description on the first match in the group. |
748 void UpdateKeywordDescriptions(AutocompleteResult* result); | 750 void UpdateKeywordDescriptions(AutocompleteResult* result); |
749 | 751 |
| 752 // For each AutocompleteMatch returned by SearchProvider, updates the |
| 753 // destination_url iff the provider's TemplateURL supports assisted query |
| 754 // stats. |
| 755 void UpdateAssistedQueryStats(AutocompleteResult* result); |
| 756 |
750 // Calls AutocompleteControllerDelegate::OnResultChanged() and if done sends | 757 // Calls AutocompleteControllerDelegate::OnResultChanged() and if done sends |
751 // AUTOCOMPLETE_CONTROLLER_RESULT_READY. | 758 // AUTOCOMPLETE_CONTROLLER_RESULT_READY. |
752 void NotifyChanged(bool notify_default_match); | 759 void NotifyChanged(bool notify_default_match); |
753 | 760 |
754 // Updates |done_| to be accurate with respect to current providers' statuses. | 761 // Updates |done_| to be accurate with respect to current providers' statuses. |
755 void CheckIfDone(); | 762 void CheckIfDone(); |
756 | 763 |
757 // Starts the expire timer. | 764 // Starts the expire timer. |
758 void StartExpireTimer(); | 765 void StartExpireTimer(); |
759 | 766 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 size_t inline_autocompleted_length; | 840 size_t inline_autocompleted_length; |
834 // Result set. | 841 // Result set. |
835 const AutocompleteResult& result; | 842 const AutocompleteResult& result; |
836 // Diagnostic information from providers. See | 843 // Diagnostic information from providers. See |
837 // AutocompleteController::AddProvidersInfo() and | 844 // AutocompleteController::AddProvidersInfo() and |
838 // AutocompleteProvider::AddProviderInfo() above. | 845 // AutocompleteProvider::AddProviderInfo() above. |
839 ProvidersInfo providers_info; | 846 ProvidersInfo providers_info; |
840 }; | 847 }; |
841 | 848 |
842 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 849 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |