| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/engine/session/blimp_engine_session.h" | 5 #include "blimp/engine/session/blimp_engine_session.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 // - the TextInputClient is changed (e.g. by a change of focus) | 414 // - the TextInputClient is changed (e.g. by a change of focus) |
| 415 // - the TextInputType of the TextInputClient changes | 415 // - the TextInputType of the TextInputClient changes |
| 416 void BlimpEngineSession::OnTextInputStateChanged( | 416 void BlimpEngineSession::OnTextInputStateChanged( |
| 417 const ui::TextInputClient* client) { | 417 const ui::TextInputClient* client) { |
| 418 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView()) | 418 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView()) |
| 419 return; | 419 return; |
| 420 | 420 |
| 421 ui::TextInputType type = | 421 ui::TextInputType type = |
| 422 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; | 422 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; |
| 423 | 423 |
| 424 // TODO(shaktisahu): Propagate the new type to the client. | |
| 425 // Hide IME, when text input is out of focus, i.e. if the text input type | 424 // Hide IME, when text input is out of focus, i.e. if the text input type |
| 426 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types, | 425 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types, |
| 427 // OnShowImeIfNeeded is used instead to send show IME request to client. | 426 // OnShowImeIfNeeded is used instead to send show IME request to client. |
| 428 if (type == ui::TEXT_INPUT_TYPE_NONE) | 427 if (type == ui::TEXT_INPUT_TYPE_NONE) |
| 429 render_widget_feature_.SendHideImeRequest( | 428 tab_->HideTextInputUI(); |
| 430 tab_->tab_id(), | |
| 431 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost()); | |
| 432 } | 429 } |
| 433 | 430 |
| 434 void BlimpEngineSession::OnInputMethodDestroyed( | 431 void BlimpEngineSession::OnInputMethodDestroyed( |
| 435 const ui::InputMethod* input_method) {} | 432 const ui::InputMethod* input_method) {} |
| 436 | 433 |
| 437 // Called when a user input should trigger showing the IME. | 434 // Called when a user input should trigger showing the IME. |
| 438 void BlimpEngineSession::OnShowImeIfNeeded() { | 435 void BlimpEngineSession::OnShowImeIfNeeded() { |
| 439 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded"); | 436 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded"); |
| 440 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() || | 437 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() || |
| 441 !window_tree_host_->GetInputMethod()->GetTextInputClient()) | 438 !window_tree_host_->GetInputMethod()->GetTextInputClient()) |
| 442 return; | 439 return; |
| 443 | 440 |
| 444 render_widget_feature_.SendShowImeRequest( | 441 tab_->ShowTextInputUI(); |
| 445 tab_->tab_id(), | |
| 446 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(), | |
| 447 window_tree_host_->GetInputMethod()->GetTextInputClient()); | |
| 448 } | 442 } |
| 449 | 443 |
| 450 void BlimpEngineSession::ProcessMessage( | 444 void BlimpEngineSession::ProcessMessage( |
| 451 std::unique_ptr<BlimpMessage> message, | 445 std::unique_ptr<BlimpMessage> message, |
| 452 const net::CompletionCallback& callback) { | 446 const net::CompletionCallback& callback) { |
| 453 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId", | 447 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId", |
| 454 message->target_tab_id()); | 448 message->target_tab_id()); |
| 455 DCHECK(!callback.is_null()); | 449 DCHECK(!callback.is_null()); |
| 456 DCHECK(BlimpMessage::kTabControl == message->feature_case() || | 450 DCHECK(BlimpMessage::kTabControl == message->feature_case() || |
| 457 BlimpMessage::kNavigation == message->feature_case()); | 451 BlimpMessage::kNavigation == message->feature_case()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 parent->AddChild(content); | 579 parent->AddChild(content); |
| 586 content->Show(); | 580 content->Show(); |
| 587 | 581 |
| 588 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id, | 582 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id, |
| 589 &render_widget_feature_, | 583 &render_widget_feature_, |
| 590 navigation_message_sender_.get()); | 584 navigation_message_sender_.get()); |
| 591 } | 585 } |
| 592 | 586 |
| 593 } // namespace engine | 587 } // namespace engine |
| 594 } // namespace blimp | 588 } // namespace blimp |
| OLD | NEW |