Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
index e42310b09283f19a2744e6dd3e23c1cff9a6af79..4918cf082b5a73949e26884545513572a5b262bc 100644 |
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
@@ -761,10 +761,11 @@ void OmniboxViewWin::UpdatePopup() { |
void OmniboxViewWin::SetFocus() { |
::SetFocus(m_hWnd); |
- // Restore caret visibility if focused explicitly. We need to do this here |
- // because if we already have invisible focus, the ::SetFocus call above will |
- // short-circuit, preventing us from reaching OmniboxEditModel::OnSetFocus(), |
- // which handles restoring visibility when we didn't previously have focus. |
+ // Restore caret visibility if focus is explicitly requested. This is |
+ // necessary because if we already have invisible focus, the ::SetFocus() |
+ // call above will short-circuit, preventing us from reaching |
+ // OmniboxEditModel::OnSetFocus(), which handles restoring visibility when the |
+ // omnibox regains focus after losing focus. |
model()->SetCaretVisibility(true); |
} |
@@ -1783,8 +1784,10 @@ LRESULT OmniboxViewWin::OnMouseActivate(HWND window, |
} |
gaining_focus_.reset(new ScopedFreeze(this, GetTextObjectModel())); |
- // Explicitely set focus visibility in the case of clicking on the omnibox, |
- // which will remove invisible focus if present. |
+ // Restore caret visibility whenever the user clicks in the omnibox in a |
+ // way that would give it focus. We must handle this case separately here |
+ // because if the omnibox currently has invisible focus, the mouse event |
+ // won't trigger either SetFocus() or OmniboxEditModel::OnSetFocus(). |
model()->SetCaretVisibility(true); |
// NOTE: Despite |mouse_message| being WM_XBUTTONDOWN here, we're not |