Make chrome hide keyboard when opening a new window

We should hide keyboard when opening a new window in Chrome. The CL
https://codereview.chromium.org/2290133002 moves the hidding logic from
onViewFocusChanged() to onViewDetachedFromWindow() and onAttach(). But
the view will not be active when it is detached from window, so the keyboard
will not be hidden.

To fix that, this CL brings back the hidding logic to onViewFocusChanged(). Thus,
we are able to hide keyboard before the view becomes inactive. Since we don’t
want to change the current behavior of Webview, i.e., not hiding keyboard when
losing focus, so we pass a parameter to distinguish that. To avoid possible
regressions, this CL keeps the previous hiding logic in onViewDetachedFromWindow()
and onAttach().

Alternatively, we can use a tab observer to determine when to hide keyboard,
but it will increase code coupling, so we stick to the above method.

BUG=677646

Review-Url: https://codereview.chromium.org/2709633002
Cr-Commit-Position: refs/heads/master@{#451950}
8 files changed