Index: chrome/browser/autocomplete/autocomplete_popup_model.h |
=================================================================== |
--- chrome/browser/autocomplete/autocomplete_popup_model.h (revision 95169) |
+++ chrome/browser/autocomplete/autocomplete_popup_model.h (working copy) |
@@ -16,6 +16,11 @@ |
class AutocompletePopupModel { |
public: |
+ enum MatchState { |
sky
2011/08/09 00:32:51
nit: description (it can be as simple as see match
|
+ NORMAL = 0, |
+ KEYWORD |
+ }; |
+ |
AutocompletePopupModel(AutocompletePopupView* popup_view, |
AutocompleteEditModel* edit_model, |
Profile* profile); |
@@ -53,6 +58,10 @@ |
return selected_line_; |
} |
+ MatchState selected_match() const { |
+ return match_state_; |
+ } |
+ |
// Call to change the selected line. This will update all state and repaint |
// the necessary parts of the window, as well as updating the edit with the |
// new temporary text. |line| will be clamped to the range of valid lines. |
@@ -69,19 +78,6 @@ |
// will change the selected line back to the default match and redraw. |
void ResetToDefaultMatch(); |
- // Gets the selected keyword or keyword hint for the given match. If the match |
- // is already keyword, then the keyword will be returned directly. Otherwise, |
- // it returns GetKeywordForText(match.fill_into_edit, keyword). |
- bool GetKeywordForMatch(const AutocompleteMatch& match, |
- string16* keyword) const; |
- |
- // Gets the selected keyword or keyword hint for the given text. Returns |
- // true if |keyword| represents a keyword hint, or false if |keyword| |
- // represents a selected keyword. (|keyword| will always be set [though |
- // possibly to the empty string], and you cannot have both a selected keyword |
- // and a keyword hint simultaneously.) |
- bool GetKeywordForText(const string16& text, string16* keyword) const; |
- |
// Immediately updates and opens the popup if necessary, then moves the |
// current selection down (|count| > 0) or up (|count| < 0), clamping to the |
// first or last result if necessary. If |count| == 0, the selection will be |
@@ -89,6 +85,11 @@ |
// AutocompleteEditModel. |
void Move(int count); |
+ // If the selected line has both a normal match and a keyword match, this can |
+ // be used to choose which to select. It is an error to call this when the |
+ // selected line does not have both matches (or there is no selection). |
+ void SetSelectedMatch(MatchState state); |
+ |
// Called when the user hits shift-delete. This should determine if the item |
// can be removed from history, and if so, remove it and update the popup. |
void TryDeletingCurrentItem(); |
@@ -126,6 +127,11 @@ |
// which should only be true when the popup is closed. |
size_t selected_line_; |
+ // If the selected line has both a normal match and a keyword match, this |
+ // determines whether the normal match (if NORMAL) or the keyword match |
+ // (if KEYWORD) is selected. |
+ MatchState match_state_; |
+ |
// The match the user has manually chosen, if any. |
AutocompleteResult::Selection manually_selected_match_; |