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

Side by Side 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: Addressing creis@ comments 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 #if defined(OS_WIN) 461 #if defined(OS_WIN)
462 legacy_render_widget_host_HWND_(nullptr), 462 legacy_render_widget_host_HWND_(nullptr),
463 legacy_window_destroyed_(false), 463 legacy_window_destroyed_(false),
464 virtual_keyboard_requested_(false), 464 virtual_keyboard_requested_(false),
465 #endif 465 #endif
466 has_snapped_to_boundary_(false), 466 has_snapped_to_boundary_(false),
467 is_guest_view_hack_(is_guest_view_hack), 467 is_guest_view_hack_(is_guest_view_hack),
468 set_focus_on_mouse_down_or_key_event_(false), 468 set_focus_on_mouse_down_or_key_event_(false),
469 device_scale_factor_(0.0f), 469 device_scale_factor_(0.0f),
470 disable_input_event_router_for_testing_(false), 470 disable_input_event_router_for_testing_(false),
471 last_active_widget_process_id_(-1),
472 last_active_widget_routing_id_(MSG_ROUTING_NONE),
471 weak_ptr_factory_(this) { 473 weak_ptr_factory_(this) {
472 if (!is_guest_view_hack_) 474 if (!is_guest_view_hack_)
473 host_->SetView(this); 475 host_->SetView(this);
474 476
475 // Let the page-level input event router know about our surface ID 477 // Let the page-level input event router know about our surface ID
476 // namespace for surface-based hit testing. 478 // namespace for surface-based hit testing.
477 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 479 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
478 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner( 480 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner(
479 GetSurfaceClientId(), this); 481 GetSurfaceClientId(), this);
480 } 482 }
(...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 bool did_update_state) { 2989 bool did_update_state) {
2988 DCHECK_EQ(text_input_manager_, text_input_manager); 2990 DCHECK_EQ(text_input_manager_, text_input_manager);
2989 2991
2990 if (!GetInputMethod()) 2992 if (!GetInputMethod())
2991 return; 2993 return;
2992 2994
2993 if (did_update_state) 2995 if (did_update_state)
2994 GetInputMethod()->OnTextInputTypeChanged(this); 2996 GetInputMethod()->OnTextInputTypeChanged(this);
2995 2997
2996 const TextInputState* state = text_input_manager_->GetTextInputState(); 2998 const TextInputState* state = text_input_manager_->GetTextInputState();
2997
2998 if (state && state->show_ime_if_needed && 2999 if (state && state->show_ime_if_needed &&
2999 state->type != ui::TEXT_INPUT_TYPE_NONE) { 3000 state->type != ui::TEXT_INPUT_TYPE_NONE) {
3000 GetInputMethod()->ShowImeIfNeeded(); 3001 GetInputMethod()->ShowImeIfNeeded();
3001
3002 // Start monitoring the composition information if the focused node is 3002 // Start monitoring the composition information if the focused node is
3003 // editable. 3003 // editable.
3004 host_->Send(new InputMsg_RequestCompositionUpdate( 3004 RenderWidgetHostImpl* last_active_widget =
3005 host_->GetRoutingID(), 3005 text_input_manager_->GetActiveWidget();
3006 false /* immediate request */, 3006 last_active_widget_routing_id_ = last_active_widget->GetRoutingID();
3007 last_active_widget_process_id_ = last_active_widget->GetProcess()->GetID();
3008 last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
3009 last_active_widget->GetRoutingID(), false /* immediate request */,
3007 true /* monitor request */)); 3010 true /* monitor request */));
3008 } else { 3011 } else {
3009 // Stop monitoring the composition information if the focused node is not 3012 // Stop monitoring the composition information if the focused node is not
3010 // editable. 3013 // editable.
3011 host_->Send(new InputMsg_RequestCompositionUpdate( 3014 if (last_active_widget_routing_id_ != MSG_ROUTING_NONE) {
3012 host_->GetRoutingID(), 3015 RenderWidgetHostImpl* last_active_widget = RenderWidgetHostImpl::FromID(
3013 false /* immediate request */, 3016 last_active_widget_process_id_, last_active_widget_routing_id_);
kenrb 2016/08/08 19:15:50 It feels weird to have this RenderWidgetHostView s
EhsanK 2016/08/09 16:42:29 How about adding a method to RWH? That will be mor
3014 false /* monitor request */)); 3017 if (!last_active_widget)
3018 return;
kenrb 2016/08/08 19:15:50 nit: It might be better to have if (last_active_wi
EhsanK 2016/08/09 16:42:29 Acknowledged.
3019 last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
3020 last_active_widget->GetRoutingID(), false /* immediate request */,
3021 false /* monitor request */));
3022 last_active_widget_process_id_ = MSG_ROUTING_NONE;
Charlie Reis 2016/08/08 17:12:01 You need to clear the routing ID as well, especial
3023 }
3015 } 3024 }
3016 } 3025 }
3017 3026
3018 void RenderWidgetHostViewAura::OnImeCancelComposition( 3027 void RenderWidgetHostViewAura::OnImeCancelComposition(
3019 TextInputManager* text_input_manager, 3028 TextInputManager* text_input_manager,
3020 RenderWidgetHostViewBase* view) { 3029 RenderWidgetHostViewBase* view) {
3021 // |view| is not necessarily the one corresponding to 3030 // |view| is not necessarily the one corresponding to
3022 // TextInputManager::GetActiveWidget() as RenderWidgetHostViewAura can call 3031 // TextInputManager::GetActiveWidget() as RenderWidgetHostViewAura can call
3023 // this method to finish any ongoing composition in response to a mouse down 3032 // this method to finish any ongoing composition in response to a mouse down
3024 // event. 3033 // event.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 3073
3065 //////////////////////////////////////////////////////////////////////////////// 3074 ////////////////////////////////////////////////////////////////////////////////
3066 // RenderWidgetHostViewBase, public: 3075 // RenderWidgetHostViewBase, public:
3067 3076
3068 // static 3077 // static
3069 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3078 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3070 GetScreenInfoForWindow(results, NULL); 3079 GetScreenInfoForWindow(results, NULL);
3071 } 3080 }
3072 3081
3073 } // namespace content 3082 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698