Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: chrome/browser/autocomplete/autocomplete_popup_model.h

Issue 9417032: Enabled pressing TAB to traverse through the Omnibox results (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete_popup_model.h
diff --git a/chrome/browser/autocomplete/autocomplete_popup_model.h b/chrome/browser/autocomplete/autocomplete_popup_model.h
index 173800a67a12593583229ebf4b081b3bc49212f8..dc10a57a806de86480287d660f4955041e1560b2 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_model.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_model.h
@@ -15,6 +15,12 @@ class SkBitmap;
class AutocompletePopupModel {
public:
+ // See selected_line_state_ for details.
+ enum LineState {
+ NORMAL = 0,
+ KEYWORD
+ };
+
AutocompletePopupModel(AutocompletePopupView* popup_view,
AutocompleteEditModel* edit_model);
~AutocompletePopupModel();
@@ -45,6 +51,10 @@ class AutocompletePopupModel {
return selected_line_;
}
+ LineState selected_line_state() const {
+ return selected_line_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.
@@ -61,19 +71,6 @@ class AutocompletePopupModel {
// 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
@@ -81,6 +78,11 @@ class AutocompletePopupModel {
// 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 SetSelectedLineState(LineState 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();
@@ -100,7 +102,7 @@ class AutocompletePopupModel {
// The token value for selected_line_, hover_line_ and functions dealing with
// a "line number" that indicates "no line".
- static const size_t kNoMatch = -1;
+ static const size_t kNoMatch;
private:
AutocompletePopupView* view_;
@@ -115,6 +117,11 @@ class AutocompletePopupModel {
// 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.
+ LineState selected_line_state_;
+
// The match the user has manually chosen, if any.
AutocompleteResult::Selection manually_selected_match_;
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_match.cc ('k') | chrome/browser/autocomplete/autocomplete_popup_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698