Chromium Code Reviews| Index: chrome/browser/ui/omnibox/omnibox_edit_model.cc |
| diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
| index ff3e0fdf807670f05da05cea814aaf65656a3fdb..224415ebec8cd4d22b6e7f2fcb2b00c99661fada 100644 |
| --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
| +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
| @@ -120,6 +120,7 @@ OmniboxEditModel::OmniboxEditModel(OmniboxView* view, |
| just_deleted_text_(false), |
| has_temporary_text_(false), |
| is_temporary_text_set_by_instant_(false), |
| + is_instant_temporary_text_a_search_query_(false), |
| paste_state_(NONE), |
| control_key_state_(UP), |
| is_keyword_hint_(false), |
| @@ -202,6 +203,7 @@ void OmniboxEditModel::SetUserText(const string16& text) { |
| paste_state_ = NONE; |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| } |
| void OmniboxEditModel::FinalizeInstantQuery(const string16& input_text, |
| @@ -246,6 +248,8 @@ void OmniboxEditModel::SetInstantSuggestion( |
| view_->SetInstantSuggestion(string16()); |
| has_temporary_text_ = true; |
| is_temporary_text_set_by_instant_ = true; |
| + is_instant_temporary_text_a_search_query_ = |
| + suggestion.type == INSTANT_SUGGESTION_SEARCH; |
| // Instant suggestions are never a keyword. |
| keyword_ = string16(); |
| is_keyword_hint_ = false; |
| @@ -460,6 +464,7 @@ void OmniboxEditModel::Revert() { |
| is_keyword_hint_ = false; |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| view_->SetWindowTextAndCaretPos(permanent_text_, |
| has_focus() ? permanent_text_.length() : 0, |
| false, true); |
| @@ -740,6 +745,7 @@ bool OmniboxEditModel::AcceptKeyword() { |
| bool save_original_selection = !has_temporary_text_; |
| has_temporary_text_ = true; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| view_->OnTemporaryTextMaybeChanged( |
| DisplayTextFromUserText(CurrentMatch().fill_into_edit), |
| save_original_selection, true); |
| @@ -878,6 +884,7 @@ void OmniboxEditModel::OnControlKeyChanged(bool pressed) { |
| InternalSetUserText(UserTextFromDisplayText(view_->GetText())); |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| } |
| if ((old_state != DOWN_WITH_CHANGE) && popup_->IsOpen()) { |
| // Autocomplete history provider results may change, so refresh the |
| @@ -946,6 +953,7 @@ void OmniboxEditModel::OnPopupDataChanged( |
| // Save the original selection and URL so it can be reverted later. |
| has_temporary_text_ = true; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| original_url_ = *destination_for_temporary_text_change; |
| inline_autocomplete_text_.clear(); |
| } |
| @@ -1051,6 +1059,7 @@ bool OmniboxEditModel::OnAfterPossibleChange(const string16& old_text, |
| InternalSetUserText(UserTextFromDisplayText(new_text)); |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| // Track when the user has deleted text so we won't allow inline |
| // autocomplete. |
| @@ -1144,6 +1153,7 @@ void OmniboxEditModel::OnResultChanged(bool default_match_changed) { |
| InternalSetUserText(UserTextFromDisplayText(view_->GetText())); |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| OnPopupBoundsChanged(gfx::Rect()); |
| delegate_->NotifySearchTabHelper(user_input_in_progress_, !in_revert_); |
| } |
| @@ -1212,8 +1222,9 @@ void OmniboxEditModel::GetInfoForCurrentText(AutocompleteMatch* match, |
| GURL* alternate_nav_url) const { |
| // If there's temporary text and it has been set by Instant, we won't find it |
| // in the popup model, so classify the text anew. |
| - if ((popup_->IsOpen() || query_in_progress()) && |
| - !is_temporary_text_set_by_instant_) { |
| + if (is_temporary_text_set_by_instant_) { |
| + // TODO XXX |
|
sreeram
2013/04/08 16:07:28
Here, I want to return either a UWYT match or a SW
Peter Kasting
2013/04/08 20:13:50
So to be clear, the reason that running through th
sreeram
2013/04/08 20:20:48
Exactly.
Peter Kasting
2013/04/08 20:34:06
K, make sure to make that clear in the comments he
|
| + } else if (popup_->IsOpen() || query_in_progress()) { |
| InfoForCurrentSelection(match, alternate_nav_url); |
| } else { |
| AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( |
| @@ -1230,6 +1241,7 @@ void OmniboxEditModel::RevertTemporaryText(bool revert_popup) { |
| just_deleted_text_ = false; |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| + is_instant_temporary_text_a_search_query_ = false; |
| InstantController* instant = controller_->GetInstant(); |
| if (instant && notify_instant) { |
| @@ -1300,9 +1312,9 @@ bool OmniboxEditModel::DoInstant(const AutocompleteMatch& match) { |
| if (!instant || in_revert_) |
| return false; |
| - // Don't call Update() if the change is a result of a |
| + // Don't call Update() if the change is the result of an |
| // INSTANT_COMPLETE_REPLACE instant suggestion. |
| - if (has_temporary_text_ && is_temporary_text_set_by_instant_) |
| + if (is_temporary_text_set_by_instant_) |
| return false; |
| // The two pieces of text we want to send Instant, viz., what the user has |