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..402077ccd8f2462b4cb8f8f91a26761093c05807 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_base.h |
| +++ b/content/browser/renderer_host/render_widget_host_view_base.h |
| @@ -21,6 +21,7 @@ |
| #include "cc/output/compositor_frame.h" |
| #include "cc/surfaces/surface_id.h" |
| #include "content/browser/renderer_host/event_with_latency_info.h" |
| +#include "content/browser/renderer_host/text_input_manager.h" |
| #include "content/common/content_export.h" |
| #include "content/common/input/input_event_ack_state.h" |
| #include "content/public/browser/readback_types.h" |
| @@ -66,14 +67,17 @@ class BrowserAccessibilityManager; |
| class RenderWidgetHostViewBaseObserver; |
| class SyntheticGesture; |
| class SyntheticGestureTarget; |
| +class TextInputManager; |
| class WebCursor; |
| struct DidOverscrollParams; |
| struct NativeWebKeyboardEvent; |
| struct TextInputState; |
| // Basic implementation shared by concrete RenderWidgetHostView subclasses. |
| -class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
| - public IPC::Listener { |
| +class CONTENT_EXPORT RenderWidgetHostViewBase |
| + : public RenderWidgetHostView, |
| + public IPC::Listener, |
| + public TextInputManager::Observer { |
| public: |
| ~RenderWidgetHostViewBase() override; |
| @@ -240,6 +244,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 +272,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; |
| @@ -379,12 +383,23 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
| virtual bool IsChildFrameForTesting() const; |
| virtual cc::SurfaceId SurfaceIdForTesting() const; |
| + // TextInputManager::Observer implementation. |
| + void OnDestroyingTextInputManager( |
| + TextInputManager* text_input_manager) override; |
|
Charlie Reis
2016/05/18 20:46:04
nit: This belongs near the top, under "IPC::Listen
EhsanK
2016/05/24 20:42:45
Done. This is removed from this class since Render
Charlie Reis
2016/05/26 06:22:03
Thanks, though that isn't what my line 24 comment
|
| + |
| protected: |
| // Interface class only, do not construct. |
| RenderWidgetHostViewBase(); |
| void NotifyObserversAboutShutdown(); |
| + // Returns a reference to the current instance of TextInputManager. If no |
| + // no reference is found, this method tries to obtain one from the |
|
Charlie Reis
2016/05/18 20:46:04
nit: "no no"
EhsanK
2016/05/24 20:42:44
Done.
|
| + // RenderWidgetHostDelegate. Returns nullptr if no reference exists or |
| + // can be obtained. Unless not possible, this method should be used internally |
|
Charlie Reis
2016/05/18 20:46:04
I don't follow the "Unless not possible" part. Is
EhsanK
2016/05/24 20:42:45
What I meant to say is that, we should always use
|
| + // to obtain TextInputManager. |
| + TextInputManager* GetTextInputManager(); |
| + |
| // Whether this view is a popup and what kind of popup it is (select, |
| // autofill...). |
| blink::WebPopupType popup_type_; |
| @@ -412,7 +427,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 +437,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 can also become nullptr if the top-level |
| + // RenderWidgetHostDelegate owning the TextInputManager is destroyed. |
| + TextInputManager* text_input_manager_; |
| + |
| private: |
| void FlushInput(); |