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

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 Created 4 years, 7 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 0a5a08116b0b8f41b97d5a0d6fbb5b575f18ced3..2466596e824612427520973c4397c2b2c7d77735 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();
//----------------------------------------------------------------------------
@@ -243,6 +250,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.
Charlie Reis 2016/06/02 22:03:29 Please clarify why this would be overridden. (It'
EhsanK 2016/06/03 17:00:34 Yes. This should be temporary and resolved after w
+ virtual void TextInputStateChanged(const TextInputState& text_input_state);
+
//----------------------------------------------------------------------------
// The following static methods are implemented by each platform.
@@ -268,9 +278,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;
@@ -388,6 +395,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.
EhsanK 2016/06/03 17:00:34 Done.
+ // Then this view is registered with TextInputManage (i.e., the instance
Charlie Reis 2016/06/02 22:03:29 nit: is registered with |text_input_manager_|. Or
EhsanK 2016/06/03 17:00:34 Done. Second suggestion applied.
+ // |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
Charlie Reis 2016/06/02 22:03:29 nit: New paragraph for "It is safer..."
EhsanK 2016/06/03 17:00:34 Done.
+ // 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_;
@@ -415,7 +434,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_;
@@ -426,6 +444,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