| Index: blimp/engine/session/blimp_engine_session.cc
|
| diff --git a/blimp/engine/session/blimp_engine_session.cc b/blimp/engine/session/blimp_engine_session.cc
|
| index 9543a83ddd5962832eda067bdb310e92faa39681..2bf53ca85172da1ac51930995b3c28a2079b8701 100644
|
| --- a/blimp/engine/session/blimp_engine_session.cc
|
| +++ b/blimp/engine/session/blimp_engine_session.cc
|
| @@ -32,6 +32,7 @@
|
| #include "content/public/browser/navigation_entry.h"
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/render_widget_host.h"
|
| +#include "content/public/browser/render_widget_host_view.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "net/base/ip_address.h"
|
| #include "net/base/net_errors.h"
|
| @@ -39,6 +40,8 @@
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_tree_host.h"
|
| +#include "ui/base/ime/input_method.h"
|
| +#include "ui/base/ime/text_input_client.h"
|
| #include "ui/gfx/geometry/size.h"
|
| #include "ui/wm/core/base_focus_rules.h"
|
| #include "ui/wm/core/default_activation_client.h"
|
| @@ -193,6 +196,8 @@ BlimpEngineSession::BlimpEngineSession(
|
| BlimpEngineSession::~BlimpEngineSession() {
|
| render_widget_feature_.RemoveDelegate(kDummyTabId);
|
|
|
| + window_tree_host_->GetInputMethod()->RemoveObserver(this);
|
| +
|
| // Ensure that all WebContents are torn down first, since teardown will
|
| // trigger RenderViewDeleted callbacks to their observers.
|
| web_contents_.reset();
|
| @@ -222,6 +227,8 @@ void BlimpEngineSession::Initialize() {
|
| capture_client_.reset(
|
| new aura::client::DefaultCaptureClient(window_tree_host_->window()));
|
|
|
| + window_tree_host_->GetInputMethod()->AddObserver(this);
|
| +
|
| window_tree_host_->SetBounds(gfx::Rect(screen_->GetPrimaryDisplay().size()));
|
|
|
| RegisterFeatures();
|
| @@ -257,6 +264,9 @@ void BlimpEngineSession::RegisterFeatures() {
|
| render_widget_feature_.set_compositor_message_sender(
|
| thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR,
|
| &render_widget_feature_));
|
| + render_widget_feature_.set_ime_message_sender(
|
| + thread_pipe_manager_->RegisterFeature(BlimpMessage::IME,
|
| + &render_widget_feature_));
|
| }
|
|
|
| bool BlimpEngineSession::CreateWebContents(const int target_tab_id) {
|
| @@ -341,6 +351,50 @@ void BlimpEngineSession::OnCompositorMessageReceived(
|
| render_widget_host->HandleCompositorProto(message);
|
| }
|
|
|
| +void BlimpEngineSession::OnTextInputTypeChanged(
|
| + const ui::TextInputClient* client) {}
|
| +
|
| +void BlimpEngineSession::OnFocus() {}
|
| +
|
| +void BlimpEngineSession::OnBlur() {}
|
| +
|
| +void BlimpEngineSession::OnCaretBoundsChanged(
|
| + const ui::TextInputClient* client) {}
|
| +
|
| +// Called when either:
|
| +// - the TextInputClient is changed (e.g. by a change of focus)
|
| +// - the TextInputType of the TextInputClient changes
|
| +void BlimpEngineSession::OnTextInputStateChanged(
|
| + const ui::TextInputClient* client) {
|
| + if (!web_contents_->GetRenderWidgetHostView())
|
| + return;
|
| +
|
| + ui::TextInputType type =
|
| + client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE;
|
| +
|
| + // TODO(shaktisahu): Propagate the new type to the client.
|
| + // Hide IME if text input is out of focus.
|
| + if (type == ui::TEXT_INPUT_TYPE_NONE)
|
| + render_widget_feature_.SendHideImeRequest(
|
| + kDummyTabId,
|
| + web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost());
|
| +}
|
| +
|
| +void BlimpEngineSession::OnInputMethodDestroyed(
|
| + const ui::InputMethod* input_method) {}
|
| +
|
| +// Called when a user input should trigger showing the IME.
|
| +void BlimpEngineSession::OnShowImeIfNeeded() {
|
| + if (!web_contents_->GetRenderWidgetHostView() ||
|
| + !window_tree_host_->GetInputMethod()->GetTextInputClient())
|
| + return;
|
| +
|
| + render_widget_feature_.SendShowImeRequest(
|
| + kDummyTabId,
|
| + web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(),
|
| + window_tree_host_->GetInputMethod()->GetTextInputClient());
|
| +}
|
| +
|
| void BlimpEngineSession::ProcessMessage(
|
| scoped_ptr<BlimpMessage> message,
|
| const net::CompletionCallback& callback) {
|
|
|