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 5fc39208de5e8044eeec8f5c67a6692a6e222b08..a86ffc86e5ea3704eb68ba64b2df243fe0a9fd10 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
@@ -526,9 +526,10 @@ 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->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."; |
sreeram
2012/09/03 22:37:07
Add "match.provider->name()" to the debug message
samarth
2012/09/04 15:48:34
Done.
|
if (index != OmniboxPopupModel::kNoMatch) |
log.selected_index = index; |
else if (!has_temporary_text_) |
@@ -691,6 +692,15 @@ void OmniboxEditModel::OnSetFocus(bool control_down) { |
if (instant) |
instant->OnAutocompleteGotFocus(); |
+ // TODO(jered): We may want to merge this into Start() and just call that |
+ // here rather than having a special entry point for zero-suggest. |
+ // Note that we avoid PermanentURL() here because it's not guaranteed to give |
+ // us the actual underlying current URL, e.g. if we're on the NTP and the |
+ // |permanent_text_| is empty. |
+ autocomplete_controller_->StartZeroSuggest( |
+ controller_->GetTabContents()->web_contents()->GetURL(), |
+ user_text_); |
+ |
NotifySearchTabHelper(); |
} |
@@ -700,6 +710,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(); |
} |