Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: blimp/engine/session/blimp_engine_session.cc

Issue 2370393002: Extracting placeholder information from Webkit to Blimp (Closed)
Patch Set: Observing InputMethod Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // - the TextInputClient is changed (e.g. by a change of focus) 395 // - the TextInputClient is changed (e.g. by a change of focus)
396 // - the TextInputType of the TextInputClient changes 396 // - the TextInputType of the TextInputClient changes
397 void BlimpEngineSession::OnTextInputStateChanged( 397 void BlimpEngineSession::OnTextInputStateChanged(
398 const ui::TextInputClient* client) { 398 const ui::TextInputClient* client) {
399 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView()) 399 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView())
400 return; 400 return;
401 401
402 ui::TextInputType type = 402 ui::TextInputType type =
403 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; 403 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE;
404 404
405 // TODO(shaktisahu): Propagate the new type to the client.
406 // Hide IME, when text input is out of focus, i.e. if the text input type 405 // Hide IME, when text input is out of focus, i.e. if the text input type
407 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types, 406 // changes to ui::TEXT_INPUT_TYPE_NONE. For other text input types,
408 // OnShowImeIfNeeded is used instead to send show IME request to client. 407 // OnUpdateTextInputState is used instead to send show IME request to client.
409 if (type == ui::TEXT_INPUT_TYPE_NONE) 408 if (type == ui::TEXT_INPUT_TYPE_NONE)
410 render_widget_feature_.SendHideImeRequest( 409 render_widget_feature_.SendHideImeRequest(
411 tab_->tab_id(), 410 tab_->tab_id(),
412 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost()); 411 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost());
413 } 412 }
414 413
415 void BlimpEngineSession::OnInputMethodDestroyed( 414 void BlimpEngineSession::OnInputMethodDestroyed(
416 const ui::InputMethod* input_method) {} 415 const ui::InputMethod* input_method) {}
417 416
418 // Called when a user input should trigger showing the IME. 417 void BlimpEngineSession::OnShowImeIfNeeded() {}
419 void BlimpEngineSession::OnShowImeIfNeeded() {
420 TRACE_EVENT0("blimp", "BlimpEngineSession::OnShowImeIfNeeded");
421 if (!tab_ || !tab_->web_contents()->GetRenderWidgetHostView() ||
422 !window_tree_host_->GetInputMethod()->GetTextInputClient())
423 return;
424 418
425 render_widget_feature_.SendShowImeRequest( 419 // Called when:
426 tab_->tab_id(), 420 // - a text area is focused.
427 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(), 421 // - text entered by the user is submitted.
428 window_tree_host_->GetInputMethod()->GetTextInputClient()); 422 void BlimpEngineSession::OnUpdateTextInputState(
423 content::RenderWidgetHost* render_widget_host,
424 ui::TextInputType type,
425 const std::string& text,
426 const std::string& placeholder,
427 bool show_ime_if_needed) {
428 if (show_ime_if_needed) {
429 render_widget_feature_.SendShowImeRequest(
430 tab_->tab_id(),
431 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost(),
Charlie Reis 2016/10/05 21:19:33 Sanity check: I'm not sure where this is running,
432 type, text, placeholder);
433 } else {
434 render_widget_feature_.SendHideImeRequest(
435 tab_->tab_id(),
436 tab_->web_contents()->GetRenderWidgetHostView()->GetRenderWidgetHost());
437 }
429 } 438 }
430 439
431 void BlimpEngineSession::ProcessMessage( 440 void BlimpEngineSession::ProcessMessage(
432 std::unique_ptr<BlimpMessage> message, 441 std::unique_ptr<BlimpMessage> message,
433 const net::CompletionCallback& callback) { 442 const net::CompletionCallback& callback) {
434 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId", 443 TRACE_EVENT1("blimp", "BlimpEngineSession::ProcessMessage", "TabId",
435 message->target_tab_id()); 444 message->target_tab_id());
436 DCHECK(!callback.is_null()); 445 DCHECK(!callback.is_null());
437 DCHECK(BlimpMessage::kTabControl == message->feature_case() || 446 DCHECK(BlimpMessage::kTabControl == message->feature_case() ||
438 BlimpMessage::kNavigation == message->feature_case()); 447 BlimpMessage::kNavigation == message->feature_case());
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 parent->AddChild(content); 575 parent->AddChild(content);
567 content->Show(); 576 content->Show();
568 577
569 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id, 578 tab_ = base::MakeUnique<Tab>(std::move(new_contents), target_tab_id,
570 &render_widget_feature_, 579 &render_widget_feature_,
571 navigation_message_sender_.get()); 580 navigation_message_sender_.get());
572 } 581 }
573 582
574 } // namespace engine 583 } // namespace engine
575 } // namespace blimp 584 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698