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 bf5901d5c47ac8eb5291de1fbe61987dff7a69fa..9b1c7f2cf309a1eb3504c1169e0ed340841824dc 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
@@ -440,13 +440,15 @@ void OmniboxEditModel::StartAutocomplete( |
} |
void OmniboxEditModel::StopAutocomplete() { |
- if (popup_->IsOpen() && !in_revert_) { |
- InstantController* instant = controller_->GetInstant(); |
- if (instant && !instant->commit_on_pointer_release()) |
- instant->Hide(); |
- } |
+ if (popup_->IsOpen()) { |
+ if (!in_revert_) { |
+ InstantController* instant = controller_->GetInstant(); |
+ if (instant && !instant->commit_on_pointer_release()) |
+ instant->Hide(); |
+ } |
- autocomplete_controller_->Stop(true); |
+ autocomplete_controller_->Stop(true); |
+ } |
} |
bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { |
@@ -531,9 +533,12 @@ void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, |
base::TimeTicks::Now() - time_user_first_modified_omnibox_, |
0, // inline autocomplete length; possibly set later |
result()); |
- DCHECK(user_input_in_progress_) << "We didn't get here through the " |
- "expected series of calls. time_user_first_modified_omnibox_ is " |
- "not set correctly and other things may be wrong."; |
+ DCHECK(user_input_in_progress_ || |
+ match.type == AutocompleteMatch::SEARCH_ZEROSUGGEST || |
+ match.type == AutocompleteMatch::SEARCH_ZEROSUGGEST_URL) |
+ << "We didn't get here through the expected series of calls. " |
+ << "time_user_first_modified_omnibox_ is not set correctly and other " |
+ << "things may be wrong."; |
if (index != OmniboxPopupModel::kNoMatch) |
log.selected_index = index; |
else if (!has_temporary_text_) |
@@ -695,6 +700,10 @@ void OmniboxEditModel::OnSetFocus(bool control_down) { |
if (instant) |
instant->OnAutocompleteGotFocus(); |
+ // TODO(jered): Remove this call once suggestions are decoupled from typing |
+ // in the omnibox. Then we can just run Zerosuggest as a normal provider. |
+ autocomplete_controller_->StartZerosuggest(PermanentURL(), user_text_); |
+ |
NotifySearchTabHelper(); |
} |
@@ -704,6 +713,8 @@ void OmniboxEditModel::OnWillKillFocus(gfx::NativeView view_gaining_focus) { |
if (InstantController* instant = controller_->GetInstant()) |
instant->OnAutocompleteLostFocus(view_gaining_focus); |
+ // TODO(jered): Rip this out along with StartZerosuggest. |
+ autocomplete_controller_->StopZerosuggest(); |
NotifySearchTabHelper(); |
} |