| 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. |
| 424 // Hide IME, when text input is out of focus, i.e. if the text input type | 425 // Hide IME, when text input is out of focus, i.e. if the text input type |
| 425 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types, | 426 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types, |
| 426 // OnShowImeIfNeeded is used instead to send show IME request to client. | 427 // OnShowImeIfNeeded is used instead to send show IME request to client. |
| 427 if (type == ui::TEXT_INPUT_TYPE_NONE) | 428 if (type == ui::TEXT_INPUT_TYPE_NONE) |
| 428 tab_->HideTextInputUI(); | 429 render_widget_feature_.SendHideImeRequest( |
| 430 tab_->tab_id(), |
| 431 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost()); |
| 429 } | 432 } |
| 430 | 433 |
| 431 void BlimpEngineSession::OnInputMethodDestroyed( | 434 void BlimpEngineSession::OnInputMethodDestroyed( |
| 432 const ui::InputMethod* input_method) {} | 435 const ui::InputMethod* input_method) {} |
| 433 | 436 |
| 434 // Called when a user input should trigger showing the IME. | 437 // Called when a user input should trigger showing the IME. |
| 435 void BlimpEngineSession::OnShowImeIfNeeded() { | 438 void BlimpEngineSession::OnShowImeIfNeeded() { |
| 436 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded"); | 439 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded"); |
| 437 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() || | 440 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() || |
| 438 !window_tree_host_->GetInputMethod()->GetTextInputClient()) | 441 !window_tree_host_->GetInputMethod()->GetTextInputClient()) |
| 439 return; | 442 return; |
| 440 | 443 |
| 441 tab_->ShowTextInputUI(); | 444 render_widget_feature_.SendShowImeRequest( |
| 445 tab_->tab_id(), |
| 446 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(), |
| 447 window_tree_host_->GetInputMethod()->GetTextInputClient()); |
| 442 } | 448 } |
| 443 | 449 |
| 444 void BlimpEngineSession::ProcessMessage( | 450 void BlimpEngineSession::ProcessMessage( |
| 445 std::unique_ptr<BlimpMessage> message, | 451 std::unique_ptr<BlimpMessage> message, |
| 446 const net::CompletionCallback& callback) { | 452 const net::CompletionCallback& callback) { |
| 447 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId", | 453 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId", |
| 448 message->target_tab_id()); | 454 message->target_tab_id()); |
| 449 DCHECK(!callback.is_null()); | 455 DCHECK(!callback.is_null()); |
| 450 DCHECK(BlimpMessage::kTabControl == message->feature_case() || | 456 DCHECK(BlimpMessage::kTabControl == message->feature_case() || |
| 451 BlimpMessage::kNavigation == message->feature_case()); | 457 BlimpMessage::kNavigation == message->feature_case()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 parent->AddChild(content); | 585 parent->AddChild(content); |
| 580 content->Show(); | 586 content->Show(); |
| 581 | 587 |
| 582 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id, | 588 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id, |
| 583 &render_widget_feature_, | 589 &render_widget_feature_, |
| 584 navigation_message_sender_.get()); | 590 navigation_message_sender_.get()); |
| 585 } | 591 } |
| 586 | 592 |
| 587 } // namespace engine | 593 } // namespace engine |
| 588 } // namespace blimp | 594 } // namespace blimp |
| OLD | NEW |