Get rid of duplicated code in InputMethodBase::DetachTextInputClient

SetFocusedTextInputClient and DetachTextInputClient can share most of the code.

BUG=none
TEST=ui_unittests --gtest_filter=InputMethodBaseTest.*

Review URL: https://codereview.chromium.org/76063002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236199 0039d316-1c4b-4281-b951-d872f2087c98
Don't call chrome::EndKeepAlive from CloudPrintWebDialogDelegate::OnDialogClosed.
chrome::EndKeepAlive maycall CloudPrintWebDialogDelegate::OnDialogClosed again.

BUG=321368

Review URL: https://codereview.chromium.org/76983004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236200 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 236200