Mojofy FrameHostMsg_TransferUserActivationFrom.

Bug: 786836
Change-Id: I37d56bedccfeb2f59f908b63d6782dc976aba76a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628732
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Camille Lamy <[email protected]>
Commit-Queue: Lowell Manners <[email protected]>
Cr-Commit-Position: refs/heads/master@{#665952}
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 753efac..d5f1f0e 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1475,8 +1475,6 @@
     IPC_MESSAGE_HANDLER(FrameHostMsg_RequestOverlayRoutingToken,
                         OnRequestOverlayRoutingToken)
     IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow)
-    IPC_MESSAGE_HANDLER(FrameHostMsg_TransferUserActivationFrom,
-                        OnTransferUserActivationFrom)
   IPC_END_MESSAGE_MAP()
 
   // No further actions here, since we may have been deleted.
@@ -3676,7 +3674,7 @@
                                disposition, initial_rect, user_gesture);
 }
 
-void RenderFrameHostImpl::OnTransferUserActivationFrom(
+void RenderFrameHostImpl::TransferUserActivationFrom(
     int32_t source_routing_id) {
   RenderFrameHostImpl* source_rfh =
       RenderFrameHostImpl::FromID(GetProcess()->GetID(), source_routing_id);
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index f163e2e2a..ef6c0ed2 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -1150,7 +1150,6 @@
       ui::input_types::ScrollGranularity granularity);
   void OnFrameDidCallFocus();
   void OnRenderFallbackContentInParentProcess();
-  void OnTransferUserActivationFrom(int32_t source_routing_id);
 
 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
   void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params);
@@ -1235,6 +1234,7 @@
   void DidFailLoadWithError(const GURL& url,
                             int error_code,
                             const base::string16& error_description) override;
+  void TransferUserActivationFrom(int32_t source_routing_id) override;
 #if defined(OS_ANDROID)
   void UpdateUserGestureCarryoverInfo() override;
 #endif
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index b0a7515..a7cb70c 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -515,4 +515,11 @@
       url.mojom.Url url,
       int32 error_code,
       mojo_base.mojom.String16 error_description);
+
+  // Sent to the browser process to transfer the user activation state from the
+  // source frame to the frame sending this IPC. The browser will update the
+  // user activation state of the frames in the frame tree in the non-source and
+  // non-target renderer processes.
+  TransferUserActivationFrom(int32 source_routing_id);
 };
+
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index c81c9fb4..eeed7b8 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -1636,13 +1636,6 @@
                     int /* offset (from current) of history item to get */,
                     bool /* has_user_gesture */)
 
-// Sent to the browser process to transfer the user activation state from the
-// source frame to the frame sending this IPC. The browser will update the user
-// activation state of the frames in the frame tree in the non-source and
-// non-target renderer processes.
-IPC_MESSAGE_ROUTED1(FrameHostMsg_TransferUserActivationFrom,
-                    int /* source_routing_id */)
-
 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
 
 // Message to show/hide a popup menu using native controls.
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 00822f6..a5cdbd9 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -7658,8 +7658,8 @@
     RenderFrameImpl* source_render_frame =
         RenderFrameImpl::FromWebFrame(source_frame);
     source_routing_id = source_render_frame->GetRoutingID();
-    Send(new FrameHostMsg_TransferUserActivationFrom(routing_id_,
-                                                     source_routing_id));
+
+    GetFrameHost()->TransferUserActivationFrom(source_routing_id);
   }
 }
 
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc
index 2f628a0..4353b5e 100644
--- a/content/test/test_render_frame.cc
+++ b/content/test/test_render_frame.cc
@@ -87,6 +87,8 @@
     }
   }
 
+  void TransferUserActivationFrom(int32_t source_routing_id) override {}
+
  protected:
   // mojom::FrameHost:
   void CreateNewWindow(mojom::CreateNewWindowParamsPtr,