Index: content/browser/renderer_host/render_widget_host_view_aura.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc |
index e31d4eb02643e5e164b1217b6d76d9b097f4d439..f05f2fbce6017265c373405d83bd5782767a65ea 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -61,6 +61,7 @@ |
#include "ui/base/clipboard/scoped_clipboard_writer.h" |
#include "ui/base/hit_test.h" |
#include "ui/base/ime/input_method.h" |
+#include "ui/base/ime/input_method_observer.h" |
#include "ui/base/ui_base_types.h" |
#include "ui/compositor/compositor_vsync_manager.h" |
#include "ui/compositor/dip_util.h" |
@@ -339,6 +340,36 @@ bool PointerEventActivates(const ui::Event& event) { |
return false; |
} |
+class KeyboardBoundsUnchangedListener : public ui::InputMethodObserver { |
+ public: |
+ KeyboardBoundsUnchangedListener(ui::InputMethod* input_method, |
+ RenderWidgetHostImpl* host) |
+ : host_(host) { |
+ input_method->AddObserver(this); |
+ } |
+ |
+ private: |
+ ~KeyboardBoundsUnchangedListener() override {} |
+ |
+ // Overridden from ui::InputMethodObserver: |
+ void OnTextInputTypeChanged(const ui::TextInputClient* client) override {} |
+ void OnFocus() override {} |
+ void OnBlur() override {} |
+ void OnCaretBoundsChanged(const ui::TextInputClient* client) override {} |
+ void OnTextInputStateChanged(const ui::TextInputClient* client) override {} |
+ void OnInputMethodDestroyed(const ui::InputMethod* input_method) override { |
+ delete this; |
+ } |
+ void OnShowImeIfNeeded() override {} |
+ void OnKeyboardBoundsUnchanged() override { |
+ host_->Send(new ViewMsg_FocusChangeComplete(host_->GetRoutingID())); |
+ } |
+ |
+ RenderWidgetHostImpl* const host_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(KeyboardBoundsUnchangedListener); |
+}; |
+ |
} // namespace |
// We need to watch for mouse events outside a Web Popup or its parent |
@@ -468,6 +499,9 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host, |
bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> |
GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
SetOverscrollControllerEnabled(overscroll_enabled); |
+ |
+ if (GetInputMethod()) |
+ new KeyboardBoundsUnchangedListener(GetInputMethod(), host_); |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -881,6 +915,9 @@ void RenderWidgetHostViewAura::OnTextInputStateChanged( |
if (GetInputMethod()) |
GetInputMethod()->ShowImeIfNeeded(); |
} |
+ |
+ if (!GetInputMethod() || !GetInputMethod()->SupportsOnScreenKeyboard()) |
+ host_->Send(new ViewMsg_FocusChangeComplete(host_->GetRoutingID())); |
} |
void RenderWidgetHostViewAura::ImeCancelComposition() { |