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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.cc

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a Compile Error Created 4 years, 9 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_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" 11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
12 #include "content/browser/renderer_host/render_process_host_impl.h" 12 #include "content/browser/renderer_host/render_process_host_impl.h"
13 #include "content/browser/renderer_host/render_view_host_delegate.h"
14 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_delegate.h" 15 #include "content/browser/renderer_host/render_widget_host_delegate.h"
14 #include "content/browser/renderer_host/render_widget_host_impl.h" 16 #include "content/browser/renderer_host/render_widget_host_impl.h"
15 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h" 17 #include "content/browser/renderer_host/render_widget_host_view_base_observer.h"
16 #include "content/common/content_switches_internal.h" 18 #include "content/common/content_switches_internal.h"
19 #include "content/common/input_messages.h"
20 #include "content/common/site_isolation_policy.h"
21 #include "content/common/text_input_state.h"
22 #include "content/common/view_messages.h"
17 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 23 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
24 #include "content/public/common/browser_plugin_guest_mode.h"
18 #include "ui/gfx/display.h" 25 #include "ui/gfx/display.h"
19 #include "ui/gfx/geometry/point_conversions.h" 26 #include "ui/gfx/geometry/point_conversions.h"
20 #include "ui/gfx/geometry/size_conversions.h" 27 #include "ui/gfx/geometry/size_conversions.h"
21 #include "ui/gfx/geometry/size_f.h" 28 #include "ui/gfx/geometry/size_f.h"
22 #include "ui/gfx/screen.h" 29 #include "ui/gfx/screen.h"
23 30
24 #if defined(OS_WIN) 31 #if defined(OS_WIN)
25 #include "base/command_line.h" 32 #include "base/command_line.h"
26 #include "base/message_loop/message_loop.h" 33 #include "base/message_loop/message_loop.h"
27 #include "base/win/wrapped_window_proc.h" 34 #include "base/win/wrapped_window_proc.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 : popup_type_(blink::WebPopupTypeNone), 379 : popup_type_(blink::WebPopupTypeNone),
373 background_color_(SK_ColorWHITE), 380 background_color_(SK_ColorWHITE),
374 mouse_locked_(false), 381 mouse_locked_(false),
375 showing_context_menu_(false), 382 showing_context_menu_(false),
376 selection_text_offset_(0), 383 selection_text_offset_(0),
377 selection_range_(gfx::Range::InvalidRange()), 384 selection_range_(gfx::Range::InvalidRange()),
378 current_device_scale_factor_(0), 385 current_device_scale_factor_(0),
379 current_display_rotation_(gfx::Display::ROTATE_0), 386 current_display_rotation_(gfx::Display::ROTATE_0),
380 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), 387 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()),
381 renderer_frame_number_(0), 388 renderer_frame_number_(0),
389 text_input_state_(new TextInputState),
Charlie Reis 2016/03/15 18:32:00 Minor nit: new TextInputState()
EhsanK 2016/03/15 23:51:17 Done.
382 weak_factory_(this) {} 390 weak_factory_(this) {}
383 391
384 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { 392 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() {
385 DCHECK(!mouse_locked_); 393 DCHECK(!mouse_locked_);
386 // We call this here to guarantee that observers are notified before we go 394 // We call this here to guarantee that observers are notified before we go
387 // away. However, some subclasses may wish to call this earlier in their 395 // away. However, some subclasses may wish to call this earlier in their
388 // shutdown process, e.g. to force removal from 396 // shutdown process, e.g. to force removal from
389 // RenderWidgetHostInputEventRouter's surface map before relinquishing a 397 // RenderWidgetHostInputEventRouter's surface map before relinquishing a
390 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling 398 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling
391 // NotifyObserversAboutShutdown() twice, as the observers are required to 399 // NotifyObserversAboutShutdown() twice, as the observers are required to
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 gfx::ToRoundedPoint(point))); 721 gfx::ToRoundedPoint(point)));
714 } 722 }
715 723
716 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace( 724 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace(
717 const gfx::Point& point, 725 const gfx::Point& point,
718 cc::SurfaceId original_surface, 726 cc::SurfaceId original_surface,
719 gfx::Point* transformed_point) { 727 gfx::Point* transformed_point) {
720 *transformed_point = point; 728 *transformed_point = point;
721 } 729 }
722 730
731 void RenderWidgetHostViewBase::TextInputStateChanged(
732 const TextInputState& params) {
733 bool text_input_state_changed = true;
734 #if !defined(OS_ANDROID)
735 if (params.type == text_input_state_->type &&
736 params.can_compose_inline == text_input_state_->can_compose_inline
737 #if !defined(OS_MACOSX)
738 && params.mode == text_input_state_->mode &&
739 params.flags == text_input_state_->flags
740 #endif
741 )
742 text_input_state_changed = false;
743 #else
744 if (params.is_non_ime_change) {
745 // Sends an acknowledgement to the renderer of a processed IME event.
746 GetRenderWidgetHost()->Send(
747 new InputMsg_ImeEventAck(GetRenderWidgetHost()->GetRoutingID()));
748 }
749 #endif
750
751 if (text_input_state_changed) {
752 *text_input_state_ = params;
753 RenderWidgetHostImpl::From(GetRenderWidgetHost())
754 ->delegate()
755 ->UpdateTextInputState(this, text_input_state_changed);
756 }
757 }
758
759 void RenderWidgetHostViewBase::UpdateInputMethodIfNecessary(
760 bool text_input_state_changed) {}
Charlie Reis 2016/03/15 18:32:00 nit: You don't need this in the .cc file if it's e
EhsanK 2016/03/15 23:51:17 Done.
761
723 void RenderWidgetHostViewBase::AddObserver( 762 void RenderWidgetHostViewBase::AddObserver(
724 RenderWidgetHostViewBaseObserver* observer) { 763 RenderWidgetHostViewBaseObserver* observer) {
725 observers_.AddObserver(observer); 764 observers_.AddObserver(observer);
726 } 765 }
727 766
728 void RenderWidgetHostViewBase::RemoveObserver( 767 void RenderWidgetHostViewBase::RemoveObserver(
729 RenderWidgetHostViewBaseObserver* observer) { 768 RenderWidgetHostViewBaseObserver* observer) {
730 observers_.RemoveObserver(observer); 769 observers_.RemoveObserver(observer);
731 } 770 }
732 771
733 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { 772 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const {
734 return cc::SurfaceId(); 773 return cc::SurfaceId();
735 } 774 }
736 775
737 } // namespace content 776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698