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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 // Asks the relevant provider to delete |match|, and ensures observers are | 664 // Asks the relevant provider to delete |match|, and ensures observers are |
665 // notified of resulting changes immediately. This should only be called when | 665 // notified of resulting changes immediately. This should only be called when |
666 // no query is running. | 666 // no query is running. |
667 void DeleteMatch(const AutocompleteMatch& match); | 667 void DeleteMatch(const AutocompleteMatch& match); |
668 | 668 |
669 // Removes any entries that were copied from the last result. This is used by | 669 // Removes any entries that were copied from the last result. This is used by |
670 // the popup to ensure it's not showing an out-of-date query. | 670 // the popup to ensure it's not showing an out-of-date query. |
671 void ExpireCopiedEntries(); | 671 void ExpireCopiedEntries(); |
672 | 672 |
| 673 // If |text| corresponds (in the sense of |
| 674 // TemplateURLModel::CleanUserInputKeyword()) to an enabled, substituting |
| 675 // keyword, returns that keyword; returns the empty string otherwise. |
| 676 string16 GetKeywordForText(const string16& text) const; |
| 677 |
673 SearchProvider* search_provider() const { return search_provider_; } | 678 SearchProvider* search_provider() const { return search_provider_; } |
674 | 679 |
675 // Getters | 680 // Getters |
676 const AutocompleteInput& input() const { return input_; } | 681 const AutocompleteInput& input() const { return input_; } |
677 const AutocompleteResult& result() const { return result_; } | 682 const AutocompleteResult& result() const { return result_; } |
678 bool done() const { return done_; } | 683 bool done() const { return done_; } |
679 | 684 |
680 // From AutocompleteProvider::Listener | 685 // From AutocompleteProvider::Listener |
681 virtual void OnProviderUpdate(bool updated_matches); | 686 virtual void OnProviderUpdate(bool updated_matches); |
682 | 687 |
(...skipping 23 matching lines...) Expand all Loading... |
706 // Input passed to Start. | 711 // Input passed to Start. |
707 AutocompleteInput input_; | 712 AutocompleteInput input_; |
708 | 713 |
709 // Data from the autocomplete query. | 714 // Data from the autocomplete query. |
710 AutocompleteResult result_; | 715 AutocompleteResult result_; |
711 | 716 |
712 // Timer used to remove any matches copied from the last result. When run | 717 // Timer used to remove any matches copied from the last result. When run |
713 // invokes |ExpireCopiedEntries|. | 718 // invokes |ExpireCopiedEntries|. |
714 base::OneShotTimer<AutocompleteController> expire_timer_; | 719 base::OneShotTimer<AutocompleteController> expire_timer_; |
715 | 720 |
| 721 Profile* profile_; |
| 722 |
716 // True if a query is not currently running. | 723 // True if a query is not currently running. |
717 bool done_; | 724 bool done_; |
718 | 725 |
719 // Are we in Start()? This is used to avoid updating |result_| and sending | 726 // Are we in Start()? This is used to avoid updating |result_| and sending |
720 // notifications until Start() has been invoked on all providers. | 727 // notifications until Start() has been invoked on all providers. |
721 bool in_start_; | 728 bool in_start_; |
722 | 729 |
723 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); | 730 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); |
724 }; | 731 }; |
725 | 732 |
(...skipping 19 matching lines...) Expand all Loading... |
745 AutocompleteInput::Type input_type; | 752 AutocompleteInput::Type input_type; |
746 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 753 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
747 size_t selected_index; | 754 size_t selected_index; |
748 // Inline autocompleted length (if displayed). | 755 // Inline autocompleted length (if displayed). |
749 size_t inline_autocompleted_length; | 756 size_t inline_autocompleted_length; |
750 // Result set. | 757 // Result set. |
751 const AutocompleteResult& result; | 758 const AutocompleteResult& result; |
752 }; | 759 }; |
753 | 760 |
754 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 761 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
OLD | NEW |