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..5fa9c306459bf38a8d5941c0380a18e6f98791dc 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
@@ -440,13 +440,15 @@ 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()) { |
+ if (!in_revert_) { |
+ InstantController* instant = controller_->GetInstant(); |
+ if (instant && !instant->commit_on_pointer_release()) |
+ instant->Hide(); |
+ } |
- autocomplete_controller_->Stop(true); |
+ autocomplete_controller_->Stop(true); |
Peter Kasting
2012/08/14 19:20:02
Nit: I think this change is safe, but it's not tot
Jered
2012/08/14 22:27:11
OmniboxView::CloseOmniboxPopup() is sometimes call
Peter Kasting
2012/08/15 05:30:39
Like when? Perhaps those calls are bugs and shoul
Jered
2012/08/15 16:32:12
It seems to happen all over the place in Mac UI co
Peter Kasting
2012/08/15 17:35:31
The call chains you wrote about don't seem like th
Jered
2012/08/15 18:15:21
I think it was the Mac mousedown bug. We got focus
|
+ } |
} |
bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { |
@@ -531,9 +533,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 || |
Peter Kasting
2012/08/14 19:20:02
Nit: Don't look at the match type, look at match.p
Jered
2012/08/14 22:27:11
Done.
|
+ 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_) |
@@ -695,6 +700,10 @@ void OmniboxEditModel::OnSetFocus(bool control_down) { |
if (instant) |
instant->OnAutocompleteGotFocus(); |
+ // TODO(jered): Remove this call once suggestions are decoupled from typing |
+ // in the omnibox. Then we can just run zero-suggest as a normal provider. |
Peter Kasting
2012/08/14 19:20:02
Nit: It's not obvious to me what this comment mean
Jered
2012/08/14 22:27:11
I reworded this to say what I mean, does this make
|
+ autocomplete_controller_->StartZeroSuggest(PermanentURL(), user_text_); |
+ |
NotifySearchTabHelper(); |
} |
@@ -704,6 +713,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(); |
Peter Kasting
2012/08/14 19:20:02
This seems unnecessary if you revert your change t
Jered
2012/08/14 22:27:11
Please see comment above.
|
NotifySearchTabHelper(); |
} |