[reland] Browser Side Text Input State Tracking for OOPIF (Aura Only)
This CL relands the original issue https://codereview.chromium.org/1652483002/,
with modifications and for aura only (Linux, Windows, etc.). T
A TextInputManager is introduced which owned by the RenderWidgetHostDelegate
(mostly, WebContentsImpl). Each RWHV will observe the TextInputManager for its destruction
and lifetime while the TextInputManager observers all the RWHVs on the tab.
The role of the TextInputManager is to bookkeep and store TextInputState from all RWHV and
provide the correct TextInputState and the RWHV with active TextInputState at anytime. These
information are used by the tab-RWHV in handling IME related tasks.
This CL also adds several tests and some utility methods to help testing IME and TextInputState
for OOPIF.
BUG=578168, 602723
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review-Url: https://codereview.chromium.org/1948343002
Cr-Commit-Position: refs/heads/master@{#398559}
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index dc77b09..25f5a96 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -73,6 +73,7 @@
class ScreenOrientationDispatcherHost;
class SiteInstance;
class TestWebContents;
+class TextInputManager;
class WakeLockServiceContext;
class WebContentsAudioMuter;
class WebContentsDelegate;
@@ -629,6 +630,7 @@
void OnRenderFrameProxyVisibilityChanged(bool visible) override;
void SendScreenRects() override;
void OnFirstPaintAfterLoad(RenderWidgetHostImpl* render_widget_host) override;
+ TextInputManager* GetTextInputManager() override;
// RenderFrameHostManager::Delegate ------------------------------------------
@@ -1385,6 +1387,14 @@
bool page_scale_factor_is_one_;
+ // TextInputManager tracks the IME-related state for all the
+ // RenderWidgetHostViews on this WebContents. Only exists on the outermost
+ // WebContents and is automatically destroyed when a WebContents becomes an
+ // inner WebContents by attaching to an outer WebContents. Then the
+ // IME-related state for RenderWidgetHosts on the inner WebContents is tracked
+ // by the TextInputManager in the outer WebContents.
+ std::unique_ptr<TextInputManager> text_input_manager_;
+
base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
base::WeakPtrFactory<WebContentsImpl> weak_factory_;