Implement IME state per window.

BUG=http://code.google.com/p/ibus/issues/detail?id=1568
TEST=Disable global engine with ibus-setup.

Review URL: https://codereview.appspot.com/12957046