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

Unified Diff: components/omnibox/browser/omnibox_controller.cc

Issue 2046263002: Fix DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: Simplify behavior Created 4 years, 6 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
« no previous file with comments | « no previous file | components/omnibox/browser/omnibox_edit_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/omnibox/browser/omnibox_controller.cc
diff --git a/components/omnibox/browser/omnibox_controller.cc b/components/omnibox/browser/omnibox_controller.cc
index 9b5b84ae48372d696b2cedca1345e34dde4ccfd6..42c59f10d6aeecb7297c2c9cb44075ebbf8e647d 100644
--- a/components/omnibox/browser/omnibox_controller.cc
+++ b/components/omnibox/browser/omnibox_controller.cc
@@ -40,7 +40,7 @@ void OmniboxController::StartAutocomplete(
}
void OmniboxController::OnResultChanged(bool default_match_changed) {
- const bool was_open = popup_->IsOpen();
+ const bool was_open = popup_ && popup_->IsOpen();
if (default_match_changed) {
// The default match has changed, we need to let the OmniboxEditModel know
// about new inline autocomplete text (blue highlight).
@@ -50,15 +50,16 @@ void OmniboxController::OnResultChanged(bool default_match_changed) {
omnibox_edit_model_->OnCurrentMatchChanged();
} else {
InvalidateCurrentMatch();
- popup_->OnResultChanged();
+ if (popup_)
+ popup_->OnResultChanged();
omnibox_edit_model_->OnPopupDataChanged(base::string16(), nullptr,
base::string16(), false);
}
- } else {
+ } else if (popup_) {
popup_->OnResultChanged();
}
- if (!popup_->IsOpen() && was_open) {
+ if (was_open && !popup_->IsOpen()) {
// Accept the temporary text as the user text, because it makes little sense
// to have temporary text when the popup is closed.
omnibox_edit_model_->AcceptTemporaryTextAsUserText();
« no previous file with comments | « no previous file | components/omnibox/browser/omnibox_edit_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698