| Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc
|
| ===================================================================
|
| --- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 209724)
|
| +++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy)
|
| @@ -646,14 +646,22 @@
|
| // as they'd intended.
|
| CHARRANGE sel;
|
| GetSelection(sel);
|
| - const bool was_reversed = (sel.cpMin > sel.cpMax);
|
| - const bool was_select_all = (sel.cpMin != sel.cpMax) &&
|
| - IsSelectAllForRange(sel);
|
| + const bool was_select_all = IsSelectAllForRange(sel);
|
|
|
| RevertAll();
|
|
|
| - if (was_select_all)
|
| - SelectAll(was_reversed);
|
| + // When the old text was empty, we don't bother selecting the new text.
|
| + // You might think we could reach here if the user has deleted the previous
|
| + // URL, but in that case the model will see that user input is in progress
|
| + // and return false from UpdatePermanentText() (so we won't reach here),
|
| + // unless we don't have focus, in which case we don't care anyway because
|
| + // re-focusing the omnibox will modify the selection regardless. The only
|
| + // time we actually reach here with empty text is when the user was on the
|
| + // NTP and clicked something on the page to navigate, in which case the
|
| + // omnibox shouldn't have focus anyway, and selecting all will at best do
|
| + // nothing and at worst cause problems like reversing the URL.
|
| + if (was_select_all && (sel.cpMin != sel.cpMax))
|
| + SelectAll(sel.cpMin > sel.cpMax);
|
| } else if (changed_security_level) {
|
| // Only the security style changed, nothing else. Redraw our text using it.
|
| EmphasizeURLComponents();
|
|
|