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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
650 | 650 |
651 // Asks the relevant provider to delete |match|, and ensures observers are | 651 // Asks the relevant provider to delete |match|, and ensures observers are |
652 // notified of resulting changes immediately. This should only be called when | 652 // notified of resulting changes immediately. This should only be called when |
653 // no query is running. | 653 // no query is running. |
654 void DeleteMatch(const AutocompleteMatch& match); | 654 void DeleteMatch(const AutocompleteMatch& match); |
655 | 655 |
656 // Removes any entries that were copied from the last result. This is used by | 656 // Removes any entries that were copied from the last result. This is used by |
657 // the popup to ensure it's not showing an out-of-date query. | 657 // the popup to ensure it's not showing an out-of-date query. |
658 void ExpireCopiedEntries(); | 658 void ExpireCopiedEntries(); |
659 | 659 |
660 // Gets the selected keyword or keyword hint for the given match. | |
Peter Kasting
2011/04/07 20:19:21
This function claims to be a getter but actually i
| |
661 void GetKeywordForMatch(AutocompleteMatch* match) const; | |
662 | |
663 // Gets the selected keyword or keyword hint for the given text. Returns | |
664 // true if |keyword| represents a keyword hint, or false if |keyword| | |
665 // represents a selected keyword. (|keyword| will always be set [though | |
Peter Kasting
2011/04/07 20:19:21
This function now seems to only have two cases: cl
| |
666 // possibly to the empty string], and you cannot have both a selected keyword | |
667 // and a keyword hint simultaneously.) | |
668 bool GetKeywordForText(const string16& text, string16* keyword) const; | |
669 | |
660 SearchProvider* search_provider() const { return search_provider_; } | 670 SearchProvider* search_provider() const { return search_provider_; } |
661 | 671 |
662 // Getters | 672 // Getters |
663 const AutocompleteInput& input() const { return input_; } | 673 const AutocompleteInput& input() const { return input_; } |
664 const AutocompleteResult& result() const { return result_; } | 674 const AutocompleteResult& result() const { return result_; } |
665 bool done() const { return done_; } | 675 bool done() const { return done_; } |
666 | 676 |
667 // From AutocompleteProvider::Listener | 677 // From AutocompleteProvider::Listener |
668 virtual void OnProviderUpdate(bool updated_matches); | 678 virtual void OnProviderUpdate(bool updated_matches); |
669 | 679 |
(...skipping 23 matching lines...) Expand all Loading... | |
693 // Input passed to Start. | 703 // Input passed to Start. |
694 AutocompleteInput input_; | 704 AutocompleteInput input_; |
695 | 705 |
696 // Data from the autocomplete query. | 706 // Data from the autocomplete query. |
697 AutocompleteResult result_; | 707 AutocompleteResult result_; |
698 | 708 |
699 // Timer used to remove any matches copied from the last result. When run | 709 // Timer used to remove any matches copied from the last result. When run |
700 // invokes |ExpireCopiedEntries|. | 710 // invokes |ExpireCopiedEntries|. |
701 base::OneShotTimer<AutocompleteController> expire_timer_; | 711 base::OneShotTimer<AutocompleteController> expire_timer_; |
702 | 712 |
713 Profile* profile_; | |
714 | |
703 // True if a query is not currently running. | 715 // True if a query is not currently running. |
704 bool done_; | 716 bool done_; |
705 | 717 |
706 // Are we in Start()? This is used to avoid updating |result_| and sending | 718 // Are we in Start()? This is used to avoid updating |result_| and sending |
707 // notifications until Start() has been invoked on all providers. | 719 // notifications until Start() has been invoked on all providers. |
708 bool in_start_; | 720 bool in_start_; |
709 | 721 |
710 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); | 722 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); |
711 }; | 723 }; |
712 | 724 |
(...skipping 19 matching lines...) Expand all Loading... | |
732 AutocompleteInput::Type input_type; | 744 AutocompleteInput::Type input_type; |
733 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 745 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
734 size_t selected_index; | 746 size_t selected_index; |
735 // Inline autocompleted length (if displayed). | 747 // Inline autocompleted length (if displayed). |
736 size_t inline_autocompleted_length; | 748 size_t inline_autocompleted_length; |
737 // Result set. | 749 // Result set. |
738 const AutocompleteResult& result; | 750 const AutocompleteResult& result; |
739 }; | 751 }; |
740 | 752 |
741 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 753 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |