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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 29943002: Limit display of the virtual keyboard to state changes triggered from a user gesture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index f52e90f609c6e3437d88536214b4c669dc10e4ce..4b2d5531e201e79e3a332f1893bb346e6d443664 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -388,6 +388,11 @@ void AcknowledgeBufferForGpu(
route_id, gpu_host_id, ack);
}
+// Sends an acknowledgement to the renderer of a processed IME event.
+void SendImeEventAck(RenderWidgetHostImpl* host) {
+ host->Send(new ViewMsg_ImeEventAck(host->GetRoutingID()));
+}
+
} // namespace
// We need to watch for mouse events outside a Web Popup or its parent
@@ -619,6 +624,18 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostViewAura, RenderWidgetHostView implementation:
+
+bool RenderWidgetHostViewAura::OnMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
+ OnTextInputStateChanged)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
void RenderWidgetHostViewAura::InitAsChild(
gfx::NativeView parent_view) {
window_->Init(ui::LAYER_TEXTURED);
@@ -1015,21 +1032,41 @@ void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
UpdateCursorIfOverSelf();
}
-void RenderWidgetHostViewAura::TextInputTypeChanged(
- ui::TextInputType type,
- ui::TextInputMode input_mode,
- bool can_compose_inline) {
- if (text_input_type_ != type ||
- text_input_mode_ != input_mode ||
- can_compose_inline_ != can_compose_inline) {
- text_input_type_ = type;
- text_input_mode_ = input_mode;
- can_compose_inline_ = can_compose_inline;
+void RenderWidgetHostViewAura::OnTextInputStateChanged(
+ const ViewHostMsg_TextInputState_Params& params) {
+ // If an acknowledgement is required for this event, regardless of how we exit
+ // from this method, we must acknowledge that we processed the input state
+ // change.
+ base::ScopedClosureRunner ack_caller;
+ if (params.require_ack)
+ ack_caller.Reset(base::Bind(&SendImeEventAck, host_));
+
+ ui::TextInputType new_type = params.type;
+ ui::TextInputMode new_mode = params.mode;
+ bool new_can_compose_inline = params.can_compose_inline;
+ if (text_input_type_ != new_type ||
+ text_input_mode_ != new_mode ||
+ can_compose_inline_ != new_can_compose_inline) {
+ text_input_type_ = new_type;
+ text_input_mode_ = new_mode;
+ can_compose_inline_ = new_can_compose_inline;
if (GetInputMethod())
GetInputMethod()->OnTextInputTypeChanged(this);
if (touch_editing_client_)
touch_editing_client_->OnTextInputTypeChanged(text_input_type_);
}
+
+ if (params.show_ime_if_needed && new_type != ui::TEXT_INPUT_TYPE_NONE) {
+ if (GetInputMethod())
+ GetInputMethod()->ShowVirtualKeyboard();
+ }
+}
+
+void RenderWidgetHostViewAura::TextInputTypeChanged(
+ ui::TextInputType type,
+ ui::TextInputMode input_mode,
+ bool can_compose_inline) {
+ // Aura uses TextInputStateChanged instead of TextInputTypeChanged.
Seigo Nonaka 2013/10/21 16:35:03 This means we have duplicated IPCs for text input
kevers 2013/10/22 19:01:42 Added TODOs to complete the task of consolidating
}
void RenderWidgetHostViewAura::ImeCancelComposition() {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698