Commit 01be2f3a authored by jdonnelly's avatar jdonnelly Committed by Commit Bot

Revert of Don't reset the omnibox state on command-return. (patchset #1 id:1...

Revert of Don't reset the omnibox state on command-return. (patchset #1 id:1 of https://codereview.chromium.org/2904243002/ )

Reason for revert:
This change caused a new issue: https://crbug.com/743288. While we decide how to proceed, it would be better to revert to the previous behavior.

Original issue's description:
> Don't reset the omnibox state on command-return.
>
> This was originally added in https://codereview.chromium.org/260008/,
> motivated it appears by a desire to match Safari's behavior. Safari no
> longer does this (the address field state is preserved on command-return
> as the new tab is openeed in the background).
>
> This change makes Chrome's behavior consistent with Safari, simplifies
> the code, fixes a bug, and is more useful IMO. If you want to open
> several tabs with variations on some search, for example, you can press
> command-return after each, then keep typing to produce the next.
>
> See discussion in the bug for more info.
>
> BUG=513966
>
> Review-Url: https://codereview.chromium.org/2904243002
> Cr-Commit-Position: refs/heads/master@{#475542}
> Committed: https://chromium.googlesource.com/chromium/src/+/1f35c3ffdebd60917647555ac6ec572098967035

TBR=rohitrao@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=513966

Review-Url: https://codereview.chromium.org/2983193002
Cr-Commit-Position: refs/heads/master@{#488362}
parent 5e147549
......@@ -829,9 +829,19 @@ bool OmniboxViewMac::OnDoCommandBySelector(SEL cmd) {
(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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment