Chromium Code Reviews| Index: components/omnibox/browser/omnibox_edit_model.h |
| diff --git a/components/omnibox/browser/omnibox_edit_model.h b/components/omnibox/browser/omnibox_edit_model.h |
| index 4c567c2b70e3cf59308c75253747641e020aaaf6..f918e49cc5ea88afe8fdadc5aa054d95d0a36e1c 100644 |
| --- a/components/omnibox/browser/omnibox_edit_model.h |
| +++ b/components/omnibox/browser/omnibox_edit_model.h |
| @@ -40,6 +40,8 @@ enum EnteredKeywordModeMethod { |
| ENTERED_KEYWORD_MODE_VIA_TAB = 0, |
| ENTERED_KEYWORD_MODE_VIA_SPACE_AT_END = 1, |
| ENTERED_KEYWORD_MODE_VIA_SPACE_IN_MIDDLE = 2, |
| + ENTERED_KEYWORD_MODE_VIA_KEYBOARD_SHORTCUT = 3, |
| + ENTERED_KEYWORD_MODE_VIA_QUESTION_MARK = 4, |
| ENTERED_KEYWORD_MODE_NUM_ITEMS |
| }; |
| @@ -59,6 +61,7 @@ class OmniboxEditModel { |
| const base::string16& gray_text, |
| const base::string16& keyword, |
| bool is_keyword_hint, |
| + EnteredKeywordModeMethod keyword_entered_method, |
| bool url_replacement_enabled, |
| OmniboxFocusState focus_state, |
| FocusSource focus_source, |
| @@ -71,6 +74,7 @@ class OmniboxEditModel { |
| const base::string16 gray_text; |
| const base::string16 keyword; |
| const bool is_keyword_hint; |
| + EnteredKeywordModeMethod keyword_entered_method; |
| bool url_replacement_enabled; |
| OmniboxFocusState focus_state; |
| FocusSource focus_source; |
| @@ -236,11 +240,15 @@ class OmniboxEditModel { |
| } |
| // Accepts the current keyword hint as a keyword. It always returns true for |
| - // caller convenience. |entered_method| indicates how the use entered |
| - // keyword mode. This parameter is only used for metrics/logging; it's not |
| - // used to change user-visible behavior. |
| + // caller convenience. |entered_method| indicates how the user entered |
| + // keyword mode. |
| bool AcceptKeyword(EnteredKeywordModeMethod entered_method); |
| + // Set the current keyword to that of the user's default search provider and |
|
Peter Kasting
2016/04/08 00:39:56
Nit: Function comments should be declarative, not
Tom (Use chromium acct)
2016/04/12 20:03:05
Done.
|
| + // update the view so the user sees "Search Google:" in the omnibox. |
|
Peter Kasting
2016/04/08 00:39:56
Nit: Don't say "Search Google" since that's not ac
Tom (Use chromium acct)
2016/04/12 20:03:05
Done.
|
| + void SetKeywordWithDefaultSearchProvider( |
|
Peter Kasting
2016/04/08 00:39:56
Nit: Maybe "EnterKeywordModeForDefaultSearchProvid
Tom (Use chromium acct)
2016/04/12 20:03:05
Done.
|
| + EnteredKeywordModeMethod keyword_entered_method); |
| + |
| // Accepts the current temporary text as the user text. |
| void AcceptTemporaryTextAsUserText(); |
| @@ -335,6 +343,7 @@ class OmniboxEditModel { |
| size_t selection_end, |
| bool selection_differs, |
| bool text_differs, |
| + bool keyword_differs, |
| bool just_deleted_text, |
| bool allow_keyword_ui_change); |
| @@ -508,6 +517,11 @@ class OmniboxEditModel { |
| bool just_deleted_text_; |
| base::string16 inline_autocomplete_text_; |
| + // If the user types '?' to enter keyword mode, and then presses backspace, |
| + // we want a '?' to be displayed on the omnibox. Without this variable, the |
| + // user would immediately be transitioned back into keyword mode. |
|
Peter Kasting
2016/04/13 02:52:16
Nit: Maybe this. I renamed the variable to match
Tom (Use chromium acct)
2016/04/13 23:37:40
Done.
|
| + bool just_cleared_keyword_; |
| + |
| // Used by OnPopupDataChanged to keep track of whether there is currently a |
| // temporary text. |
| // |
| @@ -546,6 +560,11 @@ class OmniboxEditModel { |
| // keyword_ to show a "Press <tab> to search" sort of hint. |
| bool is_keyword_hint_; |
| + // Indicates how the user entered keyword mode if the user is actually in |
| + // keyword mode. Otherwise, the value of this variable is undefined. This |
| + // is used to restore the user's search terms upon a call to ClearKeyword(). |
| + EnteredKeywordModeMethod keyword_entered_method_; |
| + |
| // This is needed to properly update the SearchModel state when the user |
| // presses escape. |
| bool in_revert_; |