 Chromium Code Reviews
 Chromium Code Reviews Issue 1779673003:
  Added network components for blimp text input feature  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1779673003:
  Added network components for blimp text input feature  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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..5fb815431b92d9811e68846ac3e0791460d496f8 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,43 @@ 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 | 
| 
David Trainor- moved to gerrit
2016/03/17 21:53:29
Add a todo to propagate the new type to the client
 | 
| +void BlimpEngineSession::OnTextInputStateChanged( | 
| + const ui::TextInputClient* client) { | 
| + ui::TextInputType type = | 
| + client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; | 
| + | 
| + // Hide IME if text input is out of focus | 
| 
David Trainor- moved to gerrit
2016/03/17 21:53:29
. at the end.
 | 
| + if (type == ui::TEXT_INPUT_TYPE_NONE) | 
| 
haibinlu
2016/03/17 18:59:46
does ui::TEXT_INPUT_TYPE_NONE mean text input is o
 
shaktisahu
2016/03/18 19:08:06
Yes, text input type changes to ui::TEXT_INPUT_TYP
 
haibinlu
2016/03/18 19:53:49
can you add this to the comment?
 | 
| + render_widget_feature_.SendHideImeRequest( | 
| + kDummyTabId, | 
| + web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(), | 
| 
Khushal
2016/03/17 10:02:45
RenderWidgetHostView can be null. Check that befor
 | 
| + client); | 
| 
Khushal
2016/03/17 10:02:45
Do you need to pass the client in this method? Loo
 | 
| +} | 
| 
haibinlu
2016/03/17 18:59:46
what happens to other types? shall you just show t
 
shaktisahu
2016/03/18 19:08:06
For other text input types, I would receive a call
 
haibinlu
2016/03/18 19:53:49
Does OnShowImeIFNeeded cover more cases for showin
 
shaktisahu
2016/03/22 19:44:18
I would think so, although the api description for
 | 
| + | 
| +void BlimpEngineSession::OnInputMethodDestroyed( | 
| + const ui::InputMethod* input_method) {} | 
| + | 
| +// Called when a user input should trigger showing the IME. | 
| +void BlimpEngineSession::OnShowImeIfNeeded() { | 
| + render_widget_feature_.SendShowImeRequest( | 
| + kDummyTabId, | 
| + web_contents_->GetRenderWidgetHostView()->GetRenderWidgetHost(), | 
| + window_tree_host_->GetInputMethod()->GetTextInputClient()); | 
| 
Khushal
2016/03/17 10:02:45
The text input client can also be null. If the exp
 | 
| +} | 
| + | 
| void BlimpEngineSession::ProcessMessage( | 
| scoped_ptr<BlimpMessage> message, | 
| const net::CompletionCallback& callback) { |