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

As is, by the time PrintViewManager::PrintPreviewDone() gets called to
unblock a Print Preview initiator, FocusController already tried to give
the initiator focus and failed, because the initiator was in a blocked

Add PrintViewManager::PrintPreviewAlmostDone() and call it right before
the Print Preview dialog closes. This is necessary to get the timing
right so the underlying Print Preview initiator can be unblocked before
the FocusController tries to give it back focus.

TEST=Manual, see bug.

Change-Id: Ifa7fcb451b94a6da82c554b685bca350be032120
Commit-Queue: Lei Zhang <>
Reviewed-by: Rebekah Potter <>
Reviewed-by: Avi Drissman <>
Cr-Commit-Position: refs/heads/master@{#637595}
3 files changed