Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 10877021: Experimental AutocompleteProvider for zerosuggest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 fbdf924bbe5a6e68da869b26718f96d96140b3da..5cad87a2598d3e18d0c79f33477c270c6b4a1de3 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -440,10 +440,12 @@ 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()) {
Peter Kasting 2012/08/27 23:13:35 Nit: Revert changes to this function
samarth 2012/08/28 23:18:46 Done.
+ if (!in_revert_) {
+ InstantController* instant = controller_->GetInstant();
+ if (instant && !instant->commit_on_pointer_release())
+ instant->Hide();
+ }
}
autocomplete_controller_->Stop(true);
@@ -531,9 +533,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.";
if (index != OmniboxPopupModel::kNoMatch)
log.selected_index = index;
else if (!has_temporary_text_)
@@ -696,6 +699,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();
}
@@ -705,6 +717,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();
}

Powered by Google App Engine
This is Rietveld 408576698