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..c56033e5bf2e466bb25640331b86e3d68aa73ce4 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,11 @@ 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.provider && match.provider->name() == "ZeroSuggest")) |
+ << "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 +699,10 @@ void OmniboxEditModel::OnSetFocus(bool control_down) { |
if (instant) |
instant->OnAutocompleteGotFocus(); |
+ // TODO(jered): Merge this into Start() and just call that here rather than |
+ // having a special entry point for zero-suggest. |
Peter Kasting
2012/08/15 05:30:39
Ah. That's what you meant.
Hmm. I wonder if we
Jered
2012/08/15 16:32:12
Done.
|
+ autocomplete_controller_->StartZeroSuggest(PermanentURL(), user_text_); |
+ |
NotifySearchTabHelper(); |
} |
@@ -704,6 +712,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(); |
} |