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

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

Issue 22795005: Omnibox: don't assume omnibox has focus in OnAfterPossibleChange(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment. Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4ee0baf09bcd9a3ca909c61bd67523d2afd9959f..e983bbca3432bc094ee0c36f77df900e704d8288 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -1032,10 +1032,15 @@ bool OmniboxEditModel::OnAfterPossibleChange(const string16& old_text,
if (text_differs || selection_differs) {
// Record current focus state for this input if we haven't already.
- DCHECK_NE(OMNIBOX_FOCUS_NONE, focus_state_);
if (focus_source_ == INVALID) {
- focus_source_ = (focus_state_ == OMNIBOX_FOCUS_VISIBLE) ?
- OMNIBOX : FAKEBOX;
+ // We should generally expect the omnibox to have focus at this point, but
+ // it doesn't always on Linux. This is because, unlike other platforms,
+ // right clicking in the omnibox on Linux doesn't focus it. So pasting via
+ // right-click can change the contents without focusing the omnibox.
+ // TODO(samarth): fix Linux focus behavior and add a DCHECK here to
+ // check that the omnibox does have focus.
+ focus_source_ = (focus_state_ == OMNIBOX_FOCUS_INVISIBLE) ?
+ FAKEBOX : OMNIBOX;
}
// Restore caret visibility whenever the user changes text or selection in
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698