Index: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
index b7f5240ffbdfe6d928203b67769e3e88ce845c5a..d692fc07277bf42f6d1d2a65aefd257f615de183 100644 |
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm |
@@ -824,9 +824,19 @@ |
(cmd == @selector(noop:) && |
([event type] == NSKeyDown || [event type] == NSKeyUp) && |
[event keyCode] == kVK_Return)) { |
+ // If the user hasn't entered any text in keyword search mode, we need to |
+ // return early in order to avoid cancelling the search. |
+ if (GetTextLength() == 0) |
+ return true; |
+ |
WindowOpenDisposition disposition = |
ui::WindowOpenDispositionFromNSEvent(event); |
model()->AcceptInput(disposition, false); |
+ // Opening a URL in a background tab should also revert the omnibox contents |
+ // to their original state. We cannot do a blanket revert in OpenURL() |
+ // because middle-clicks also open in a new background tab, but those should |
+ // not revert the omnibox text. |
+ RevertAll(); |
return true; |
} |