Add InputMethodObserver support into InputMethodBase

This is a preparation CL to fix issue 164964.

Following observer callbacks are defined but not yet
supported by ui::InputMethodBase and its sub classes.
- InputMethodObserver::OnCaretBoundsChanged
- InputMethodObserver::OnInputLocaleChanged

This CL makes these callbacks functional for each
sub class of ui::InputMethodBase.

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

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231563 0039d316-1c4b-4281-b951-d872f2087c98
LRESULT InputMethodWin::OnQueryCharPosition(IMECHARPOSITION* char_positon) {
  if (!char_positon)
    return 0;

  if (char_positon->dwSize < sizeof(IMECHARPOSITION))
    return 0;

  ui::TextInputClient* client = GetTextInputClient();
  if (!client)
    return 0;

  gfx::Rect rect;
  if (client->HasCompositionText()) {
    if (!client->GetCompositionCharacterBounds(char_positon->dwCharPos,
                                               &rect)) {
      return 0;
    }
  } else {
    if (char_positon->dwCharPos != 0)
      return 0;
    rect = client->GetCaretBounds();
  }

  char_positon->pt.x = rect.x();
  char_positon->pt.y = rect.y();
  char_positon->cLineHeight = rect.height();
  return 1;  // returns non-zero value when succeeded.
}

LRESULT InputMethodWin::OnQueryCharPosition(IMECHARPOSITION* char_positon) {
  if (!char_positon)
    return 0;

  if (char_positon->dwSize < sizeof(IMECHARPOSITION))
    return 0;

  ui::TextInputClient* client = GetTextInputClient();
  if (!client)
    return 0;

  gfx::Rect rect;
  if (client->HasCompositionText()) {
    if (!client->GetCompositionCharacterBounds(char_positon->dwCharPos,
                                               &rect)) {
      return 0;
    }
  } else {
    if (char_positon->dwCharPos != 0)
      return 0;
    rect = client->GetCaretBounds();
  }

  char_positon->pt.x = rect.x();
  char_positon->pt.y = rect.y();
  char_positon->cLineHeight = rect.height();
  return 1;  // returns non-zero value when succeeded.
}
