Fix keyboard focus on webpages after finishing window.print() with ESC.

This is another variant of the issue fixed by r637595. Instead of
pressing the cancel button in the Print Preview UI, users can press the
ESC key instead. In this case, the sequence of events is different, and
PrintPreviewDialogDelegate::OnDialogClosed() gets called too late.

To fix this, add ui::WebDialogDelegate::OnDialogClosingFromKeyEvent(),
and call it when the ConstrainedDialogWebView sees the ESC key being
pressed. In PrintPreviewDialogDelegate::OnDialogClosingFromKeyEvent(),
call OnDialogClosed() to properly unblock the webpage.

BUG=936542
TEST=Manual, see bug.

Change-Id: I0640ee7da86d407965ba6c6bbe3bbb17accf2ed5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1515910
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#640026}
3 files changed