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

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: 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 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();
}

Powered by Google App Engine
This is Rietveld 408576698