Chromium Code Reviews| 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 8eb96897ecc8dc2feca83d74474372a6cdcf1550..24b53564b94439de8033bfcd89e22f013148afd8 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_base.h |
| +++ b/content/browser/renderer_host/render_widget_host_view_base.h |
| @@ -66,6 +66,7 @@ class BrowserAccessibilityManager; |
| class RenderWidgetHostViewBaseObserver; |
| class SyntheticGesture; |
| class SyntheticGestureTarget; |
| +class TextInputManager; |
| class WebCursor; |
| struct DidOverscrollParams; |
| struct NativeWebKeyboardEvent; |
| @@ -126,6 +127,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(); |
| //---------------------------------------------------------------------------- |
| @@ -240,6 +247,9 @@ 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. |
| + virtual void TextInputStateChanged(const TextInputState& text_input_state); |
| + |
| //---------------------------------------------------------------------------- |
| // The following static methods are implemented by each platform. |
| @@ -265,9 +275,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; |
| @@ -385,6 +392,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_|. |
|
Charlie Reis
2016/06/02 22:03:29
nit: No space before comma.
|
| + // Then this view is registered with TextInputManage (i.e., the instance |
| + // |text_input_manager_| referes to). 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 |
| + // 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_; |
| @@ -412,7 +431,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_; |
| @@ -423,6 +441,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(); |