Migrate ViewHostMsg_NotifyTextAutosizerPageInfoChangedInLocalMainFrame

Convert the legacy IPC message
ViewHostMsg_NotifyTextAutosizerPageInfoChangedInLocalMainFrame to
a LocalMainFrameHost Mojo message.

This CL adds an accessor
RenderFrameHostImpl::local_main_frame_host_receiver() so that tests we
intercept Mojo calls.

Bug: 1053546
Change-Id: Ib697a972584edf2723aada7cd262dff80c01d47f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083174
Commit-Queue: Henrique Ferreiro <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Reviewed-by: Dave Tapuska <[email protected]>
Cr-Commit-Position: refs/heads/master@{#760900}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 3529479..44a80d2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -892,19 +892,17 @@
       return true;
   }
 
+#if BUILDFLAG(ENABLE_PLUGINS)
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContentsImpl, message, render_view_host)
-    IPC_MESSAGE_HANDLER(
-        ViewHostMsg_NotifyTextAutosizerPageInfoChangedInLocalMainFrame,
-        OnTextAutosizerPageInfoChanged)
-#if BUILDFLAG(ENABLE_PLUGINS)
     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission,
                         OnRequestPpapiBrokerPermission)
-#endif
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
-
   return handled;
+#else
+  return false;
+#endif
 }
 
 bool WebContentsImpl::OnMessageReceived(RenderFrameHostImpl* render_frame_host,
@@ -5026,14 +5024,18 @@
 }
 
 void WebContentsImpl::OnTextAutosizerPageInfoChanged(
-    RenderViewHostImpl* source,
-    const blink::WebTextAutosizerPageInfo& page_info) {
+    RenderFrameHostImpl* source,
+    blink::mojom::TextAutosizerPageInfoPtr page_info) {
   // Keep a copy of |page_info| in case we create a new RenderView before
   // the next update.
-  text_autosizer_page_info_ = page_info;
+  text_autosizer_page_info_.main_frame_width = page_info->main_frame_width;
+  text_autosizer_page_info_.main_frame_layout_width =
+      page_info->main_frame_layout_width;
+  text_autosizer_page_info_.device_scale_adjustment =
+      page_info->device_scale_adjustment;
   frame_tree_.root()->render_manager()->SendPageMessage(
       new PageMsg_UpdateTextAutosizerPageInfoForRemoteMainFrames(
-          MSG_ROUTING_NONE, page_info),
+          MSG_ROUTING_NONE, text_autosizer_page_info_),
       source->GetSiteInstance());
 }