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

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: Using the Old Logic for Determining the State Change 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),
382 weak_factory_(this) {} 389 text_input_state_(new TextInputState),
390 text_input_state_changed_(false),
391 weak_factory_(this) {
392 cached_text_input_state_ = text_input_state_.get();
393 }
383 394
384 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { 395 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() {
385 DCHECK(!mouse_locked_); 396 DCHECK(!mouse_locked_);
386 // We call this here to guarantee that observers are notified before we go 397 // 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 398 // away. However, some subclasses may wish to call this earlier in their
388 // shutdown process, e.g. to force removal from 399 // shutdown process, e.g. to force removal from
389 // RenderWidgetHostInputEventRouter's surface map before relinquishing a 400 // RenderWidgetHostInputEventRouter's surface map before relinquishing a
390 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling 401 // host pointer, as in RenderWidgetHostViewGuest. There is no harm in calling
391 // NotifyObserversAboutShutdown() twice, as the observers are required to 402 // NotifyObserversAboutShutdown() twice, as the observers are required to
392 // de-register on the first call, and so the second call does nothing. 403 // de-register on the first call, and so the second call does nothing.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 current_display_rotation_ == display.rotation()) { 570 current_display_rotation_ == display.rotation()) {
560 return false; 571 return false;
561 } 572 }
562 573
563 current_display_area_ = display.work_area(); 574 current_display_area_ = display.work_area();
564 current_device_scale_factor_ = display.device_scale_factor(); 575 current_device_scale_factor_ = display.device_scale_factor();
565 current_display_rotation_ = display.rotation(); 576 current_display_rotation_ = display.rotation();
566 return true; 577 return true;
567 } 578 }
568 579
580 bool RenderWidgetHostViewBase::ShouldProcessTextInputState() {
581 if (text_input_state_changed_) {
582 text_input_state_changed_ = false;
583 return true;
584 }
585 return false;
586 }
587
569 base::WeakPtr<RenderWidgetHostViewBase> RenderWidgetHostViewBase::GetWeakPtr() { 588 base::WeakPtr<RenderWidgetHostViewBase> RenderWidgetHostViewBase::GetWeakPtr() {
570 return weak_factory_.GetWeakPtr(); 589 return weak_factory_.GetWeakPtr();
571 } 590 }
572 591
573 scoped_ptr<SyntheticGestureTarget> 592 scoped_ptr<SyntheticGestureTarget>
574 RenderWidgetHostViewBase::CreateSyntheticGestureTarget() { 593 RenderWidgetHostViewBase::CreateSyntheticGestureTarget() {
575 RenderWidgetHostImpl* host = 594 RenderWidgetHostImpl* host =
576 RenderWidgetHostImpl::From(GetRenderWidgetHost()); 595 RenderWidgetHostImpl::From(GetRenderWidgetHost());
577 return scoped_ptr<SyntheticGestureTarget>( 596 return scoped_ptr<SyntheticGestureTarget>(
578 new SyntheticGestureTargetBase(host)); 597 new SyntheticGestureTargetBase(host));
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 gfx::ToRoundedPoint(point))); 732 gfx::ToRoundedPoint(point)));
714 } 733 }
715 734
716 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace( 735 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace(
717 const gfx::Point& point, 736 const gfx::Point& point,
718 cc::SurfaceId original_surface, 737 cc::SurfaceId original_surface,
719 gfx::Point* transformed_point) { 738 gfx::Point* transformed_point) {
720 *transformed_point = point; 739 *transformed_point = point;
721 } 740 }
722 741
742 void RenderWidgetHostViewBase::TextInputStateChanged(
743 const TextInputState& params) {
744 text_input_state_changed_ = true;
745 #if !defined(OS_ANDROID)
746 if (params.type == text_input_state_->type &&
747 params.can_compose_inline == text_input_state_->can_compose_inline
748 #if !defined(OS_MACOSX)
749 && params.mode == text_input_state_->mode &&
750 params.flags == text_input_state_->flags
751 #endif
752 )
753 text_input_state_changed_ = false;
754 #else
755 if (params.is_non_ime_change) {
756 // Sends an acknowledgement to the renderer of a processed IME event.
757 GetRenderWidgetHost()->Send(
758 new InputMsg_ImeEventAck(GetRenderWidgetHost()->GetRoutingID()));
759 }
760 #endif
761
762 if (text_input_state_changed_)
763 *text_input_state_ = params;
764
765 UpdateTextInputState();
766 }
767
768 RenderWidgetHostViewBase* RenderWidgetHostViewBase::GetFocusedView() {
769 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible())
770 return this;
771 RenderWidgetHostViewBase* focused_view =
772 RenderWidgetHostImpl::From(GetRenderWidgetHost())
773 ->delegate()
774 ->GetFocusedView();
775 return !!focused_view ? focused_view : this;
776 }
777
778 void RenderWidgetHostViewBase::UpdateTextInputState() {}
779
723 void RenderWidgetHostViewBase::AddObserver( 780 void RenderWidgetHostViewBase::AddObserver(
724 RenderWidgetHostViewBaseObserver* observer) { 781 RenderWidgetHostViewBaseObserver* observer) {
725 observers_.AddObserver(observer); 782 observers_.AddObserver(observer);
726 } 783 }
727 784
728 void RenderWidgetHostViewBase::RemoveObserver( 785 void RenderWidgetHostViewBase::RemoveObserver(
729 RenderWidgetHostViewBaseObserver* observer) { 786 RenderWidgetHostViewBaseObserver* observer) {
730 observers_.RemoveObserver(observer); 787 observers_.RemoveObserver(observer);
731 } 788 }
732 789
733 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { 790 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const {
734 return cc::SurfaceId(); 791 return cc::SurfaceId();
735 } 792 }
736 793
737 } // namespace content 794 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698