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

Unified Diff: content/browser/renderer_host/render_widget_host_view_base.h

Issue 1948343002: [reland] Browser Side Text Input State Tracking for OOPIF (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (Code changed during CQ Dry-run) Created 4 years, 6 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_base.h
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
index c5c6cdf55fe7f0ef338e741996761ebbdda6df55..772dca1e4fa010c89bc1ecc6da8bbc16109b854d 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.h
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -67,6 +67,7 @@ class BrowserAccessibilityManager;
class RenderWidgetHostViewBaseObserver;
class SyntheticGesture;
class SyntheticGestureTarget;
+class TextInputManager;
class WebCursor;
struct DidOverscrollParams;
struct NativeWebKeyboardEvent;
@@ -129,6 +130,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// changed since the last time.
bool HasDisplayPropertyChanged(gfx::NativeView view);
+ // Called by the TextInputManager to notify the view about being removed from
+ // the list of registered views, i.e., TextInputManager is no longer tracking
+ // TextInputState from this view. The RWHV should reset |text_input_manager_|
+ // to nullptr.
+ void DidUnregisterFromTextInputManager(TextInputManager* text_input_manager);
+
base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr();
//----------------------------------------------------------------------------
@@ -245,6 +252,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
cc::SurfaceId original_surface,
gfx::Point* transformed_point);
+ // Updates the state of the input method attached to the view.
+ // TODO(ekaramad): This method will not stay virtual. It will be moved up top
+ // with the other non-virtual methods after TextInputState tracking is fixed
+ // on all platforms (https://crbug.com/578168).
+ virtual void TextInputStateChanged(const TextInputState& text_input_state);
+
//----------------------------------------------------------------------------
// The following static methods are implemented by each platform.
@@ -270,9 +283,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// Indicates whether the page has finished loading.
virtual void SetIsLoading(bool is_loading) = 0;
- // Updates the state of the input method attached to the view.
- virtual void TextInputStateChanged(const TextInputState& params) = 0;
-
// Cancel the ongoing composition of the input method attached to the view.
virtual void ImeCancelComposition() = 0;
@@ -390,6 +400,18 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
void NotifyObserversAboutShutdown();
+ // Returns a reference to the current instance of TextInputManager. The
+ // reference is obtained from RenderWidgetHostDelegate. The first time a non-
+ // null reference is obtained, its value is cached in |text_input_manager_|
+ // and this view is registered with it. The RWHV will unregister from the
+ // TextInputManager if it is destroyed or if the TextInputManager itself is
+ // destroyed. The unregistration of the RWHV from TextInputManager is
+ // necessary and must be done by explicitly calling
+ // TextInputManager::Unregister.
+ // It is safer to use this method rather than directly dereferencing
+ // |text_input_manager_|.
+ TextInputManager* GetTextInputManager();
+
// Whether this view is a popup and what kind of popup it is (select,
// autofill...).
blink::WebPopupType popup_type_;
@@ -417,7 +439,6 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// The current selection range relative to the start of the web page.
gfx::Range selection_range_;
- protected:
// The scale factor of the display the renderer is currently on.
float current_device_scale_factor_;
@@ -428,6 +449,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView,
// renderer.
bool pinch_zoom_enabled_;
+ // A reference to current TextInputManager instance this RWHV is registered
+ // with. This is initially nullptr until the first time the view calls
+ // GetTextInputManager(). It also becomes nullptr when TextInputManager is
+ // destroyed before the RWHV is destroyed.
+ TextInputManager* text_input_manager_;
+
private:
void FlushInput();

Powered by Google App Engine
This is Rietveld 408576698