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

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: 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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/common/content_switches_internal.h" 47 #include "content/common/content_switches_internal.h"
48 #include "content/common/input_messages.h" 48 #include "content/common/input_messages.h"
49 #include "content/common/site_isolation_policy.h" 49 #include "content/common/site_isolation_policy.h"
50 #include "content/common/text_input_state.h" 50 #include "content/common/text_input_state.h"
51 #include "content/common/view_messages.h" 51 #include "content/common/view_messages.h"
52 #include "content/public/browser/content_browser_client.h" 52 #include "content/public/browser/content_browser_client.h"
53 #include "content/public/browser/overscroll_configuration.h" 53 #include "content/public/browser/overscroll_configuration.h"
54 #include "content/public/browser/render_view_host.h" 54 #include "content/public/browser/render_view_host.h"
55 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 55 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
56 #include "content/public/browser/user_metrics.h" 56 #include "content/public/browser/user_metrics.h"
57 #include "content/public/common/child_process_host.h"
57 #include "content/public/common/content_switches.h" 58 #include "content/public/common/content_switches.h"
58 #include "gpu/ipc/common/gpu_messages.h" 59 #include "gpu/ipc/common/gpu_messages.h"
59 #include "third_party/WebKit/public/platform/WebScreenInfo.h" 60 #include "third_party/WebKit/public/platform/WebScreenInfo.h"
60 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 61 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
61 #include "third_party/WebKit/public/web/WebInputEvent.h" 62 #include "third_party/WebKit/public/web/WebInputEvent.h"
62 #include "ui/aura/client/aura_constants.h" 63 #include "ui/aura/client/aura_constants.h"
63 #include "ui/aura/client/cursor_client.h" 64 #include "ui/aura/client/cursor_client.h"
64 #include "ui/aura/client/cursor_client_observer.h" 65 #include "ui/aura/client/cursor_client_observer.h"
65 #include "ui/aura/client/focus_client.h" 66 #include "ui/aura/client/focus_client.h"
66 #include "ui/aura/client/screen_position_client.h" 67 #include "ui/aura/client/screen_position_client.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 #if defined(OS_WIN) 462 #if defined(OS_WIN)
462 legacy_render_widget_host_HWND_(nullptr), 463 legacy_render_widget_host_HWND_(nullptr),
463 legacy_window_destroyed_(false), 464 legacy_window_destroyed_(false),
464 virtual_keyboard_requested_(false), 465 virtual_keyboard_requested_(false),
465 #endif 466 #endif
466 has_snapped_to_boundary_(false), 467 has_snapped_to_boundary_(false),
467 is_guest_view_hack_(is_guest_view_hack), 468 is_guest_view_hack_(is_guest_view_hack),
468 set_focus_on_mouse_down_or_key_event_(false), 469 set_focus_on_mouse_down_or_key_event_(false),
469 device_scale_factor_(0.0f), 470 device_scale_factor_(0.0f),
470 disable_input_event_router_for_testing_(false), 471 disable_input_event_router_for_testing_(false),
472 last_active_widget_process_id_(ChildProcessHost::kInvalidUniqueID),
473 last_active_widget_routing_id_(MSG_ROUTING_NONE),
471 weak_ptr_factory_(this) { 474 weak_ptr_factory_(this) {
472 if (!is_guest_view_hack_) 475 if (!is_guest_view_hack_)
473 host_->SetView(this); 476 host_->SetView(this);
474 477
475 // Let the page-level input event router know about our surface ID 478 // Let the page-level input event router know about our surface ID
476 // namespace for surface-based hit testing. 479 // namespace for surface-based hit testing.
477 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) { 480 if (host_->delegate() && host_->delegate()->GetInputEventRouter()) {
478 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner( 481 host_->delegate()->GetInputEventRouter()->AddSurfaceClientIdOwner(
479 GetSurfaceClientId(), this); 482 GetSurfaceClientId(), this);
480 } 483 }
(...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 bool did_update_state) { 2990 bool did_update_state) {
2988 DCHECK_EQ(text_input_manager_, text_input_manager); 2991 DCHECK_EQ(text_input_manager_, text_input_manager);
2989 2992
2990 if (!GetInputMethod()) 2993 if (!GetInputMethod())
2991 return; 2994 return;
2992 2995
2993 if (did_update_state) 2996 if (did_update_state)
2994 GetInputMethod()->OnTextInputTypeChanged(this); 2997 GetInputMethod()->OnTextInputTypeChanged(this);
2995 2998
2996 const TextInputState* state = text_input_manager_->GetTextInputState(); 2999 const TextInputState* state = text_input_manager_->GetTextInputState();
2997
2998 if (state && state->show_ime_if_needed && 3000 if (state && state->show_ime_if_needed &&
2999 state->type != ui::TEXT_INPUT_TYPE_NONE) { 3001 state->type != ui::TEXT_INPUT_TYPE_NONE) {
3000 GetInputMethod()->ShowImeIfNeeded(); 3002 GetInputMethod()->ShowImeIfNeeded();
3001
3002 // Start monitoring the composition information if the focused node is 3003 // Start monitoring the composition information if the focused node is
3003 // editable. 3004 // editable.
3004 host_->Send(new InputMsg_RequestCompositionUpdate( 3005 RenderWidgetHostImpl* last_active_widget =
3005 host_->GetRoutingID(), 3006 text_input_manager_->GetActiveWidget();
3006 false /* immediate request */, 3007 last_active_widget_routing_id_ = last_active_widget->GetRoutingID();
3008 last_active_widget_process_id_ = last_active_widget->GetProcess()->GetID();
3009 last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
3010 last_active_widget->GetRoutingID(), false /* immediate request */,
3007 true /* monitor request */)); 3011 true /* monitor request */));
3008 } else { 3012 } else {
3009 // Stop monitoring the composition information if the focused node is not 3013 // Stop monitoring the composition information if the focused node is not
3010 // editable. 3014 // editable.
3011 host_->Send(new InputMsg_RequestCompositionUpdate( 3015 RenderWidgetHostImpl* last_active_widget = RenderWidgetHostImpl::FromID(
3012 host_->GetRoutingID(), 3016 last_active_widget_process_id_, last_active_widget_routing_id_);
3013 false /* immediate request */, 3017 if (last_active_widget) {
3014 false /* monitor request */)); 3018 last_active_widget->Send(new InputMsg_RequestCompositionUpdate(
3019 last_active_widget->GetRoutingID(), false /* immediate request */,
3020 false /* monitor request */));
3021 }
3022 last_active_widget_routing_id_ = MSG_ROUTING_NONE;
3023 last_active_widget_process_id_ = ChildProcessHost::kInvalidUniqueID;
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 3090
3082 //////////////////////////////////////////////////////////////////////////////// 3091 ////////////////////////////////////////////////////////////////////////////////
3083 // RenderWidgetHostViewBase, public: 3092 // RenderWidgetHostViewBase, public:
3084 3093
3085 // static 3094 // static
3086 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 3095 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
3087 GetScreenInfoForWindow(results, NULL); 3096 GetScreenInfoForWindow(results, NULL);
3088 } 3097 }
3089 3098
3090 } // namespace content 3099 } // namespace content
OLDNEW
« 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