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 131ee220f3452f182e9fa35e129002f7e3b34feb..228ca0eff6f0c557c834ad0bc9b1f2d1a46eb09c 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
@@ -439,13 +439,15 @@ void OmniboxEditModel::StartAutocomplete( |
} |
void OmniboxEditModel::StopAutocomplete() { |
- if (popup_->IsOpen() && !in_revert_) { |
- InstantController* instant = controller_->GetInstant(); |
- if (instant && !instant->commit_on_pointer_release()) |
- instant->DestroyPreviewContents(); |
- } |
+ if (popup_->IsOpen()) { |
+ if (!in_revert_) { |
+ InstantController* instant = controller_->GetInstant(); |
+ if (instant && !instant->commit_on_pointer_release()) |
+ instant->DestroyPreviewContents(); |
+ } |
- autocomplete_controller_->Stop(true); |
+ autocomplete_controller_->Stop(true); |
+ } |
} |
bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { |
@@ -530,9 +532,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_) |
@@ -694,6 +699,8 @@ void OmniboxEditModel::OnSetFocus(bool control_down) { |
if (instant) |
instant->OnAutocompleteGotFocus(); |
+ autocomplete_controller_->StartZerosuggest(PermanentURL(), user_text_); |
+ |
NotifySearchTabHelper(); |
} |
@@ -704,6 +711,7 @@ void OmniboxEditModel::OnWillKillFocus(gfx::NativeView view_gaining_focus) { |
if (instant) |
instant->OnAutocompleteLostFocus(view_gaining_focus); |
+ autocomplete_controller_->StopZerosuggest(); |
NotifySearchTabHelper(); |
} |