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

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

Issue 10832256: Experimental AutocompleteProvider for zerosuggest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments. 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 bf5901d5c47ac8eb5291de1fbe61987dff7a69fa..6e6bd2ec32340f49e2767f6fcde84047bc573093 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/15 21:52:44 Nit: Revert remaining change to this function
Jered 2012/08/15 23:13:00 Done.
+ if (!in_revert_) {
+ InstantController* instant = controller_->GetInstant();
+ if (instant && !instant->commit_on_pointer_release())
+ instant->Hide();
+ }
}
autocomplete_controller_->Stop(true);
@@ -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"))
Peter Kasting 2012/08/15 21:52:44 Nit: You don't need "match.provider &&", all match
Jered 2012/08/15 23:13:00 Done.
+ << "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,12 @@ 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.
Peter Kasting 2012/08/15 21:52:44 Nit: Might want: // Note that we avoid PermanentU
Jered 2012/08/15 23:13:00 Done.
+ autocomplete_controller_->StartZeroSuggest(
+ controller_->GetTabContents()->web_contents()->GetURL(),
+ user_text_);
+
NotifySearchTabHelper();
}
@@ -704,6 +714,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