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 1cace30a162137c4f2b016d0ba5892fbc13051db..54f25da6ac14936364b7d613402f4fb3285aaaec 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_base.h |
+++ b/content/browser/renderer_host/render_widget_host_view_base.h |
@@ -41,7 +41,7 @@ class SkBitmap; |
struct AccessibilityHostMsg_EventParams; |
struct ViewHostMsg_SelectionBounds_Params; |
-struct ViewHostMsg_TextInputState_Params; |
+struct TextInputState; |
namespace media { |
class VideoFrame; |
@@ -70,6 +70,7 @@ class SyntheticGestureTarget; |
class WebCursor; |
struct DidOverscrollParams; |
struct NativeWebKeyboardEvent; |
+struct TextInputState; |
struct WebPluginGeometry; |
// Basic implementation shared by concrete RenderWidgetHostView subclasses. |
@@ -127,6 +128,13 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
// changed since the last time. |
bool HasDisplayPropertyChanged(gfx::NativeView view); |
+ // The current text input state for the corresponding widget. This is used by |
+ // the WebContents in determining the top level text input state, which is |
+ // in turn used by the IME. |
+ const TextInputState* text_input_state() const { |
+ return text_input_state_.get(); |
+ } |
+ |
base::WeakPtr<RenderWidgetHostViewBase> GetWeakPtr(); |
//---------------------------------------------------------------------------- |
@@ -236,6 +244,22 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
cc::SurfaceId original_surface, |
gfx::Point* transformed_point); |
+ // This method is exclusively called by the owner RenderWidgetHost to inform |
+ // the view about a change in the input state which originated in the |
+ // corresponding RenderWidget. This state is stored at the RWHV. |
+ // Also, this change does not necessarily reflect the current state of the |
+ // input since the text input could be due to a change in the focused |
+ // child-frame's (in OOPIF) or the out of process content managed by |
+ // BrowserPlugin. |
+ // TODO(ekaramad): This method should not stay virtual. |
+ virtual void TextInputStateChanged(const TextInputState& params); |
+ |
+ // This method is used by the WebContents owning this view to notify the view |
+ // of a text input change in the tab. This method is called by the |
+ // WebContentsImp if the RenderWidgetHostView is a top-level view. The |
Charlie Reis
2016/03/16 16:55:13
nit: WebContentsImpl
EhsanK
2016/03/30 20:46:03
Done.
|
+ // implementation is platform-specific. |
+ virtual void UpdateInputMethodIfNecessary(bool text_input_state_changed) {} |
+ |
//---------------------------------------------------------------------------- |
// The following static methods are implemented by each platform. |
@@ -266,10 +290,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 ViewHostMsg_TextInputState_Params& params) = 0; |
- |
// Cancel the ongoing composition of the input method attached to the view. |
virtual void ImeCancelComposition() = 0; |
@@ -408,6 +428,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
void NotifyObserversAboutShutdown(); |
+ // This method should be called by RWHV during destruction or after a crash |
+ // to make sure WebContents does not hold invalid text input state. |
+ // TODO(ekaramad): Do we need to call this for top-level RWHV as well? |
+ void NotifyHostDelegateAboutShutdown(); |
+ |
#if defined(OS_WIN) |
// Shared implementation of MovePluginWindows for use by win and aura/wina. |
static void MovePluginWindowsHelper( |
@@ -450,7 +475,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_; |
@@ -472,6 +496,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, |
base::ObserverList<RenderWidgetHostViewBaseObserver> observers_; |
+ // The last reported input state by the RenderWidget. |
+ scoped_ptr<TextInputState> text_input_state_; |
+ |
base::WeakPtrFactory<RenderWidgetHostViewBase> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |