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

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

Issue 2208583005: Request to start/stop calculating composition info from RenderWidget when it is active/inactive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased (nona@'s patch relanded) Created 4 years, 4 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
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 35364cb2584fbb97c09088df47f5cbb1b4e81620..0c313ec4e7b2ad07b267cb3627fcfdb3e04f9421 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -54,6 +54,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/common/child_process_host.h"
#include "content/public/common/content_switches.h"
#include "gpu/ipc/common/gpu_messages.h"
#include "third_party/WebKit/public/platform/WebScreenInfo.h"
@@ -468,6 +469,8 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host,
set_focus_on_mouse_down_or_key_event_(false),
device_scale_factor_(0.0f),
disable_input_event_router_for_testing_(false),
+ last_active_widget_process_id_(ChildProcessHost::kInvalidUniqueID),
+ last_active_widget_routing_id_(MSG_ROUTING_NONE),
weak_ptr_factory_(this) {
if (!is_guest_view_hack_)
host_->SetView(this);
@@ -2994,24 +2997,30 @@ void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
GetInputMethod()->OnTextInputTypeChanged(this);
const TextInputState* state = text_input_manager_->GetTextInputState();
-
if (state && state->show_ime_if_needed &&
state->type != ui::TEXT_INPUT_TYPE_NONE) {
GetInputMethod()->ShowImeIfNeeded();
-
// Start monitoring the composition information if the focused node is
// editable.
- host_->Send(new InputMsg_RequestCompositionUpdate(
- host_->GetRoutingID(),
- false /* immediate request */,
+ RenderWidgetHostImpl* last_active_widget =
+ text_input_manager_->GetActiveWidget();
+ last_active_widget_routing_id_ = last_active_widget->GetRoutingID();
+ last_active_widget_process_id_ = last_active_widget->GetProcess()->GetID();
+ last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
+ last_active_widget->GetRoutingID(), false /* immediate request */,
true /* monitor request */));
} else {
// Stop monitoring the composition information if the focused node is not
// editable.
- host_->Send(new InputMsg_RequestCompositionUpdate(
- host_->GetRoutingID(),
- false /* immediate request */,
- false /* monitor request */));
+ RenderWidgetHostImpl* last_active_widget = RenderWidgetHostImpl::FromID(
+ last_active_widget_process_id_, last_active_widget_routing_id_);
+ if (last_active_widget) {
+ last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
+ last_active_widget->GetRoutingID(), false /* immediate request */,
+ false /* monitor request */));
+ }
+ last_active_widget_routing_id_ = MSG_ROUTING_NONE;
+ last_active_widget_process_id_ = ChildProcessHost::kInvalidUniqueID;
}
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/public/test/text_input_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698