OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 // Removes any entries that were copied from the last result. This is used by | 667 // Removes any entries that were copied from the last result. This is used by |
668 // the popup to ensure it's not showing an out-of-date query. | 668 // the popup to ensure it's not showing an out-of-date query. |
669 void ExpireCopiedEntries(); | 669 void ExpireCopiedEntries(); |
670 | 670 |
671 #ifdef UNIT_TEST | 671 #ifdef UNIT_TEST |
672 void set_search_provider(SearchProvider* provider) { | 672 void set_search_provider(SearchProvider* provider) { |
673 search_provider_ = provider; | 673 search_provider_ = provider; |
674 } | 674 } |
675 #endif | 675 #endif |
676 SearchProvider* search_provider() const { return search_provider_; } | 676 SearchProvider* search_provider() const { return search_provider_; } |
| 677 KeywordProvider* keyword_provider() const { return keyword_provider_; } |
677 | 678 |
678 // Getters | 679 // Getters |
679 const AutocompleteInput& input() const { return input_; } | 680 const AutocompleteInput& input() const { return input_; } |
680 const AutocompleteResult& result() const { return result_; } | 681 const AutocompleteResult& result() const { return result_; } |
681 bool done() const { return done_; } | 682 bool done() const { return done_; } |
682 | 683 |
683 // From AutocompleteProvider::Listener | 684 // From AutocompleteProvider::Listener |
684 virtual void OnProviderUpdate(bool updated_matches); | 685 virtual void OnProviderUpdate(bool updated_matches); |
685 | 686 |
686 private: | 687 private: |
687 // Updates |result_| to reflect the current provider state. Resets timers and | 688 // Updates |result_| to reflect the current provider state. Resets timers and |
688 // fires notifications as necessary. |is_synchronous_pass| is true only when | 689 // fires notifications as necessary. |is_synchronous_pass| is true only when |
689 // Start() is calling this to get the synchronous result. | 690 // Start() is calling this to get the synchronous result. |
690 void UpdateResult(bool is_synchronous_pass); | 691 void UpdateResult(bool is_synchronous_pass); |
691 | 692 |
| 693 // Updates |result_| to populate each match's |associated_keyword| if that |
| 694 // match can show a keyword hint. |result_| should be sorted by |
| 695 // relevance before this is called. |
| 696 void PopulateMatchKeywordHints(); |
| 697 |
692 // For each group of contiguous matches from the same TemplateURL, show the | 698 // For each group of contiguous matches from the same TemplateURL, show the |
693 // provider name as a description on the first match in the group. | 699 // provider name as a description on the first match in the group. |
694 void UpdateKeywordDescriptions(AutocompleteResult* result); | 700 void UpdateKeywordDescriptions(AutocompleteResult* result); |
695 | 701 |
696 // Calls AutocompleteControllerDelegate::OnResultChanged() and if done sends | 702 // Calls AutocompleteControllerDelegate::OnResultChanged() and if done sends |
697 // AUTOCOMPLETE_CONTROLLER_RESULT_READY. | 703 // AUTOCOMPLETE_CONTROLLER_RESULT_READY. |
698 void NotifyChanged(bool notify_default_match); | 704 void NotifyChanged(bool notify_default_match); |
699 | 705 |
700 // Updates |done_| to be accurate with respect to current providers' statuses. | 706 // Updates |done_| to be accurate with respect to current providers' statuses. |
701 void CheckIfDone(); | 707 void CheckIfDone(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 AutocompleteInput::Type input_type; | 762 AutocompleteInput::Type input_type; |
757 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 763 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
758 size_t selected_index; | 764 size_t selected_index; |
759 // Inline autocompleted length (if displayed). | 765 // Inline autocompleted length (if displayed). |
760 size_t inline_autocompleted_length; | 766 size_t inline_autocompleted_length; |
761 // Result set. | 767 // Result set. |
762 const AutocompleteResult& result; | 768 const AutocompleteResult& result; |
763 }; | 769 }; |
764 | 770 |
765 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 771 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |